-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (33 loc) · 864 Bytes
/
main.cpp
File metadata and controls
41 lines (33 loc) · 864 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
#include <iostream>
#include <stdio.h>
#include "module.h"
using namespace std;
int main(int argc, char* argv[])
{
char direction;
Module* pModule = new Module();
pModule->init();
pModule->show();
while(pModule->isRunning()){
cin >> direction;
if (direction == _UP){
cout << "you inter k" << endl;
pModule->mvUp();
}else if (direction == _DOWN){
cout << "you inter j" << endl;
pModule->mvDown();
}else if (direction == _LEFT){
cout << "you inter h" << endl;
pModule->mvLeft();
}else if (direction == _RIGHT){
cout << "you inter l" << endl;
pModule->mvRight();
}else{
cout << "unknown command,please inter [j(down),k(up),h(left),l(right)]" << endl;
pModule->show();
continue;
}
pModule->show();
}
return 0;
}