-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (40 loc) · 1023 Bytes
/
Copy pathmain.cpp
File metadata and controls
46 lines (40 loc) · 1023 Bytes
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
#include <iostream>
#include <vector>
#include "tasks.h"
using namespace std;
int main() {
vector<Task> tasks;
string filename = "tasks.txt";
// load data at start
loadTasks(tasks, filename);
int choice = 0;
// loop until they pick 4
while (choice != 4) {
printMenu();
// check if input is a number
if (!(cin >> choice)) {
cin.clear();
cin.ignore(1000, '\n');
continue;
}
//using switch statment for choice
switch (choice) {
case 1:
addTask(tasks);
break;
case 2:
viewTasks(tasks);
break;
case 3:
completeTask(tasks);
break;
case 4:
cout << "Ending tasks" << endl;
saveTasks(tasks, filename);
break;
default:
cout << "Invalid choice." << endl;
}
}
return 0;
}