forked from ZXCroon/Wordable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_interface.cpp
executable file
·57 lines (48 loc) · 1.34 KB
/
main_interface.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "main_interface.h"
MainInterface::MainInterface(Env* env, SelectStrategy* sstra, FormStrategy* fstra) :
Interaction(env), quit(false), sstra(sstra), fstra(fstra) {
}
void MainInterface::work() {
cout << " Hi, " << env->getUserName() << ". What do you want to do?" << endl << endl;
cout << " Word learning [l]" << endl;
cout << " Word query [q]" << endl;
cout << " Word test [t]" << endl;
cout << " New word counting [c]" << endl;
cout << " Settings [s]" << endl;
cout << " Exit [e]" << endl;
cout << " ";
for (;;) {
string res = str::readSent(cin);
if (res == "e" || res == "E") {
quit = true;
return;
}
if (res == "l" || res == "L") {
nextInter = new Learn(sstra, fstra, env);
break;
}
if (res == "q" || res == "Q") {
nextInter = new LookUpWord(env);
break;
}
if (res == "t" || res == "T") {
nextInter = new TestWord(env);
break;
}
if (res == "c" || res == "C") {
nextInter = new Count(env);
break;
}
if (res == "s" || res == "S") {
nextInter = new Settings(env);
break;
}
cout << " Illegal input! Please re-input: " << endl;
}
}
bool MainInterface::toQuit() {
return quit;
}
Interaction* MainInterface::getNextInter() {
return nextInter;
}