-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackInterface.cpp
More file actions
68 lines (59 loc) · 1.66 KB
/
TrackInterface.cpp
File metadata and controls
68 lines (59 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "TaskList.h"
#include <iostream>
#include <string>
using namespace std;
void addTask(TaskList &toDoList, string task) {
toDoList.pushBack(task);
cout << task << ", has been added to your to do list! " << endl << endl;;
}
void removeTask(TaskList &toDoList) {
cout << toDoList.pop();
cout << " has been removed from your to do list!" << endl << endl;
}
void displayTasks(TaskList &toDoList) {
toDoList.traverseList();
}
void completeTask(TaskList &toDoList) {
if (!toDoList.isEmpty()) { //Making sure at least one task is in the list to complete
cout << toDoList.pop();
cout << " has been completed!" << endl;
toDoList.addPoints();
}
else {
cout << "There is nothing on your list to complete!" << endl;
}
}
int main() {
TaskList list;
char cont = ' '; //variable to continue using system or not
cout << "Welcome to Task Tracker Version 1!" << endl;
while (cont != 'Q') {
string task = " "; //Task to be added
cout << "Please enter what you would like to do (A: to add task), (R: to remove task), (D: to display list), (C: to show task was completed) and (Q: to quit): " << endl;
cin >> cont;
switch(cont) {
case 'A':
cout << "Enter task you wish to add to your to do list: " << endl;
cin.ignore();
getline(cin, task);
addTask(list, task);
break;
case 'R':
removeTask(list);
break;
case 'D':
displayTasks(list);
break;
case 'C':
completeTask(list);
break;
case 'Q':
cout << "Shutting down" << endl;
break;
default:
cout << "That is not a recognized command please try again. ";
break;
}
}
return 0;
}