-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui-demo.cpp
More file actions
46 lines (40 loc) · 1.01 KB
/
ui-demo.cpp
File metadata and controls
46 lines (40 loc) · 1.01 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
#include "ui-demo.h"
int main() {
if (!jobPool::is_logined()) {
cout << "Enter a username and password";
string uname, pword;
cin >> uname >> pword;
if(jobPool::set_user_credentials_to(uname, pword))
cout << "Entered a user's credentials\n";
}
// "activates" the ui - clears the screen and captures input
UI* ui = new UI();
jobPool deck(jobPool::get_credential().at(0), jobPool::get_credential().at(1));
while(1) {
int mode = ui->present_menu();
if (mode == 0) {
while(1) {
card* c = deck.get_next_card();
if (c == nullptr) {
break;
}
performance result = ui->present_card(*c);
if (result == unf) {
break;
}
deck.study((*c), result);
}
}
else if (mode == 1) {
string front = "";
string back = "";
ui->create_card(front, back);
deck.add_new_card(front, back);
}
else if (mode == 2) {
break;
}
}
// this is important to allow the program to cleanly exit & allow the terminal to behave normally after termination
delete ui;
}