Todo List Exercise

 

Objective

To get further experience dealing with C programs.
 

Task

For this lab you will make a modification to the Todo list program we worked on in class. Begin by downloading the files for this program and making sure it compiles and runs.

Next we'll add code to make it so tasks can be marked as completed. That will involve the following:

  1. Add a field in the Task struct for whether the task is complete.
  2. Add a function in task.h/c which takes a Task parameter and marks it as complete.
  3. Add a function in task.h/c which returns the id of a Task parameter.
  4. Add a function in list.h/c which takes an integer parameter and marks the task in the list which has that id as completed.
  5. Change the list_print function so it has an extra parameter indicating whether completed tasks should be printed or not. A 0 indicates that completed tasks should not be printed while a 1 indicates all tasks should be printed.
  6. Add code to the main function to provide a menu option to mark a task as complete. When this is chosen, we need to read in the id of the task, and then call our list function to mark that task as complete.
  7. In main, pass 0 for the new parameter to list_print, so only active tasks are printed.

 

Submitting

When you are done, please submit the .c and .h files under the assignment in Canvas.