-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.cpp
48 lines (42 loc) · 1.27 KB
/
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
#include "interface.h"
#include <iomanip>
#include <iostream>
using namespace std;
Interface::Interface(WordContainer *wordContainer)
:myWordContainer(wordContainer)
{
}
void Interface::exec()
{
while(1)
{
cout << ">> ";
string tmp;
cin >> tmp;
if(tmp == "exit")
return;
if(tmp == "show")
{
int dd;
cin >> dd;
Date* date = new Date();
(*date) -= dd;
myWordContainer->show(date);
}
else
showHelpBox();
}
}
void Interface::showHelpBox() const
{
cout << setfill('*') << setw(60) << "" << endl;
cout << setfill(' ') << "* " << std::left << setw(57) << "" << "*" << endl;
cout << "* " << setfill(' ') << std::left << setw(15) << "show dd"
<< setw(42) << "Show words learned in 'dd' days ago" << "*" << endl;
cout << "* " << setfill(' ') << std::left << setw(15) << "test dd"
<< setw(42) << "Test words learned in 'dd' days ago" << "*" << endl;
cout << "* " << setfill(' ') << std::left << setw(15) << "exit"
<< setw(42) << "Exit this program" << "*" << endl;
cout << setfill(' ') << "* " << std::left << setw(57) << "" << "*" << endl;
cout << setfill('*') << setw(60) << "" << endl;
}