siddartha-004 / firstProjClockReminders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Individuals often face difficulty in managing their schedules and keep track of important events,tasks,deadlines.This is scalable and robust reminder solution that allow to schedule unlimited reminders.


Concepts used: linked list,stack using linked list

Description of each module

Push function for adding new remainder

1.new node is created that contain info of dn,mn,yn,th,tm,label(date,time)

2.If list is empty , the new node becomes both the first and last node in the list.

3.If the list is not empty, the code traverses through the list to find the correct position to insert the new node. It compares the date and time components of the new node with those of existing nodes to maintain the sorted order.Once the correct position is found, the new node is inserted before the node pointed to by place.

4.If place is pointing to the first node, nn becomes the new first node.Otherwise, nn is inserted between place and place->next.

5.After insertion, if the last node's next pointer points to nn, it means nn is now the last node, so last is updated to point to nn.Finally, the function returns a pointer to the newly inserted node nn.

Removing a label

function that searches for nodes in a doubly linked list based on a given label (S).If a matching node is found, it prints its details. Then, based on user input, it allows the user to delete the found reminders.

lcn: an array of pointers to store pointers to nodes matching the label.count: to count the number of matching nodes found.

1.If a match is found, it prints the details of the matching node and stores a pointer to the matching node in the lcn array. It then advances tmp to the next node in the list.

2.f flag is still 1, it means no matching node was found, and it prints a message indicating no matched labels so no deletion.

3.If a valid serial number is entered, it calls the del function to delete the corresponding reminder node.

4.If the node is successfully deleted, it updates the lcn array and prints a success message.

Deleting a remainder in lcn array

deletes a node from a doubly linked list based on the provided position (pos)

1.It checks cases of first,last if yes perform its removal if not between then it removes node and free it

2.if c=='m' it create a file

Creating a file

1.It creates a filename using sprintf, where num is presumably a global or static variable used to generate unique filenames.

2.writes nn data to opened file and close file

3.It pushes the filename onto a stack using the function SOPpush

SOPpush function (stack using sll)

1.create node with name as file name

1.if top is null then nop is our first ele

2.if not null then update pointers

Display all remainders

if list empty display no remainders

else print all remainders

ooprs used to perform redo and undo operations

1.It opens a file based on whether the operation is undo ('u') or redo ('r').

2.It reads the reminder data from the file.

3.If the operation is undo and the reminder data matches an existing reminder in the list, it removes that reminder.

4.If the operation is redo, it pushes a new reminder onto the list with the same data as read from the file.

5.Finally, it pops an operation from the stack.

Pop operations in nt,rdt

if 'u' push that file to rdt and update ny

if 'r' push to nt and update rdt

For each node (nn) in the redo stack, this part removes the file associated with the node's name (remove(nn->name)) and deallocates the memory allocated to the node (free(nn)).


Flow chart of program:
image

Results:
image image image image

About


Languages

Language:C 100.0%