需要关于此作业的帮助?欢迎联系我

DPST1091 Assignment 2 CS ToDo

In assignment 2 you will be implementing a todo list, to help Ben keep track of all the jobs he has to do for DPST1091! Todo lists are a classic first project for any aspiring developer, so we decided to let you implement your own todo list in C, to get some more practice working with linked lists.

Overview

Assignment Structure

This assignment will test your ability to create, use, manipulate and solve problems using linked lists. To do this, the todo list is implemented as a linked list of tasks, and another separate linked list is used to keep track of your “completed tasks”.

We have defined some structs in the provided code to get you started. You may modify any of the structs if you wish, but you should not need to.

struct todo_list
    Purpose:
        To store all of the information about our todo list.
    Contains:
        struct task *tasks
            A pointer to the first task in the todo list.
        struct completed_task *completed_tasks
            A pointer to the first completed task in the list
struct task
    Purpose:
        To store information about a task on your list.
    Contains:
        char task_name[MAX_TASK_LENGTH]
            The name of the task (e.g “Finish-Assignment-2”)
        char category[MAX_CATEGORY_LENGTH]
            The task’s category (e.g “Assignments”)
        enum priority priority
            The task’s priority - how urgent is it that the task is completed?) (e.g HIGH)
        struct task *next
            A pointer to the next task in the list.
struct completed_task
    Purpose:
        To hold information about a task that has already been completed.
    Contains:
        struct task *task
            A pointer to a task that has been completed, and removed from the tasks list. The next pointer of this task should always point to NULL.
        int start_time
            The time at which we started this task. It will be given in 24-hour time (e.g 1234 corresponds to a time of 12:34pm). You have been provided with functions to process these times.
        int finish_time
            The time at which we finished this task.
        struct completed_task *next
            A pointer to the next completed task in the list.

Hint:

  1. Remember to initialise every field inside the structs when creating them (not just the fields you are using at that moment!).
  2. There are diagrams inside stages 1 and 2 to indicate what your todo list should look like.

Commands

more ...