Question
C++ This is a long promblem, and I also have the question partially done. I just need some general steps to help get going. Create
C++
This is a long promblem, and I also have the question partially done. I just need some general steps to help get going.
Create a simple ToDo list. Conceptually the ToDo list uses a structure called MyToDo to hold information about each todo item. The members of the MyToDo struct are description, due date, and priority. Each of these items will be stored in an array called ToDoList. The definition for the MyToDo struct should be placed in the header file called ToDo.h
There are two ways to add items to the ToDoList. The first is to simply fill out a MyToDo struct and pass it to a function called addToList.
The second way to add items to the list is by passing to the function the description (as a string), the priority (as an int), and the DueDate (as a string).
When you get an item from the ToDoList, you call a function called getNextItem which returns the first item in the list. With each successive call to getNextItem, you get the next item in the array. After you get the last item from the array the next call to getNextItem will start over at the beginning.
Determine what the data section is. In this case it is going to be the array called ToDoList that holds MyToDo structs, put this array in global scope.
Required functions
Funciton | Arguments | Description |
addToList | A MyToDo Struct | Adds a single MyToDoStruct to the ToDoList. The struct should contain information about a todo item |
addToList | Description (string), date (string), priority (int) | Overloaded function that adds a single MyToDo Struct to the ToDoList. In this case you are passing individual items that need to go into a struct |
getNextItem | A MyToDo struct(by reference) | Gets the next MyToDo struct from the ToDoList. When the last item is returned the next call to getNextItem should return the first item in the list |
getNextItem | Description (string), date (string), priority (int) | All variables should be passed by reference, This function works like the overloaded version except that it returns the information from the struct as individual values not structs |
getByPriority | An array of MyToDo structs, priority (as int) | This function searches theToDoList array looking for items that have a matching priority. A list of all of the items with matching priorities will be returned to main |
printToDo | None | Simply prints out each item in the todo array list one time . |
You should have three files
main.cpp - holds you main function
ToDo.cpp - holds the ToDo list functions that are required for the assignment
ToDo.h - which holds the definitions for ToDo list
Here is how things should flow for the addToList function:
In main create an instance of the MyToDo struct
fill the struct with information about an item to do. Get it from the keyboard if you want.
Pass the struct to addToList which attempts to add the MyToDo to the next slot in the array.
If the ToDoList is full and an item cannot be added then addToList returns false
If the item was successfully added to the array addToList returns true
Here is how things should flow for the getNextItem function:
In main create a MyToDo struct
call getNextItem function passing the created struct by reference
If the ToDoList is empty getNextItem simply returns false
If the ToDoList is not empty the next itme in the ToDo list is copied to the struct passed by reference and true is returned
*If the last item in the todo list is returned back, the next call to getNextItem will get the first item in the todo list again.
*This is circular so if have 5 items in the ToDo list and you call getNextItem in a loop 25 times from main all five todo items will be returned five times.
Here is how the getByPriortiy functions should flow:
In main create an array that will hold MyToDo Items
pass the array along with a priority to search for to the getByPriority function.
the getByPriority function will search the array looking to match the priority
If a match is found the found the struct is copied to the array that was passed to the function.
If no match is found the function simply returns false.
When the funciton returns from main you should be able to print a list of items with the matching priority.
What not to do
Using any of the following will drop your grade for this assignment by 70%
cin in any funciton other than main
*cout in any funciton other than main and the printToDo function
passing the ToDoList array to any function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started