To Do

This assignment is intended to see if youve learned the basic concepts talked about thus far in the lectures.

This assignment requires the use of structures

Program

In this assignment, you will define a structure, and then create and populate some with data from the user.

The structure should contain a positive unsigned int representing priority (closer to 1 representing higher priority), and a string (C++ string object) representing a task that the user must do, eg;

  • Chores
  • Walk the dog
  • Do Assignment #8

You must write 3 functions with the given signatures/prototypes:

1. Returns a pointer to a new ToDo structure instance.

ToDo* newTodo()

  • Complete both fields of the structure (priority and task) by asking the user via the console

2. Given an array of ToDo pointers returns a pointer to the first ToDo with the highest priority. (remember, the lowest integer value is the highest priority)

ToDo* getFirstPriority(ToDo**, int)

3. Given a pointer to an array of ToDo pointers, releases the associated memory.

void empty(ToDo**, int);

Execution

The programs entry point function (main) has been written for you, do not alter this function.

You must implement the three functions above and define a structure that will work with the code provided. Start your program using the code attached to this assignment (A08.cpp).

  • Your program will ask for tasks from the user, via the newTodo function (the 1 st function, above).
  • Your program must then use function (2 nd , above) to find the item with the highest priority (indicated by the smallest integer)
    • If two or more items both have equal priority, find the first entry with the highest priority.
  • Your program will then display this highest priority task.
  • Your program will delete all the ToDo items created via newTodo(); (3 rd function)

Sample

How many Tasks will there be?
3
What is the task?
Cleaning
What is the priority of this task?
2
What is the task?
Assignment 8
What is the priority of this task?
1
What is the task?
Watch Stranger Things
What is the priority of this task?
5

You should do "Assignment 8" first.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.