-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (42 loc) · 1.05 KB
/
main.cpp
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
#include "item.h"
#include "todolist.h"
int main(void) {
start:
todolist mylist("mytasks.txt");
mylist.read();
if (mylist.getcount() > 0) {
string choice = "";
while(true) {
cout << "1: Add" << endl;
cout << "2: Clear" << endl;
cout << "3: Display" << endl;
cout << "4: Check/Uncheck" << endl;
input:
std::getline(std::cin, choice);
if (choice.empty()) {
goto input;
}
switch(stoi(choice)) {
case 1:
mylist.add();
break;
case 2:
mylist.clear();
break;
case 3:
mylist.display();
break;
case 4:
mylist.check();
break;
default:
break;
}
choice.clear();
}
} else {
mylist.create();
mylist.save();
goto start;
}
}