-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (40 loc) · 871 Bytes
/
main.cpp
File metadata and controls
48 lines (40 loc) · 871 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
42
43
44
45
46
47
48
#include "Controller.h"
int main()
{
int c = 10;
bool closed = false;
int numofstages = 5;
while (c!=3) {
int stage_num = 1; // first stage has number 1
Controller GameControl(stage_num, numofstages);
c = GameControl.open();
while (c != 3)
{
// if c == 0 means that player want to play
if (c == 0) {
bool win = true;
while (win)
{
if (stage_num > numofstages)//if there is no remain stages, exit
break;
win = GameControl.startGame();
// if the player won the stage, move to the next stage
if (win)
stage_num++;
}
break;
}
// id c==1 means that teh player wants help
else if (c == 1)
{
GameControl.help();
c = GameControl.open();
continue;
}
// id c==2 means that teh player wants to exit
else if (c == 2)
return EXIT_SUCCESS;
}
}
return 0;
}