-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.c
More file actions
38 lines (36 loc) · 861 Bytes
/
Copy pathmain.c
File metadata and controls
38 lines (36 loc) · 861 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
#include "Header/pong.h"
#include "Header/snake.h"
#include "Header/space_invaders.h"
#include "Header/tetris.h"
typedef enum {
PONG = '1', SNAKE, SPACE_INVADERS, TETRIS
} ArcadeGames;
int main() {
srand((unsigned int)time(NULL));
while(TRUE) {
printf( "Press 1 to play Pong."
"\nPress 2 to play Snake."
"\nPress 3 to play Space Invaders."
"\nPress 4 to play Tetris."
"\nPress Esc to exit.");
char choose_game = getch();
switch(choose_game) {
case PONG:
PlayPong(); // play Pong
break;
case SNAKE:
PlaySnake(); // play Snake
break;
case SPACE_INVADERS:
PlaySpaceInvaders(); // play Space Invaders
break;
case TETRIS:
PlayTetris(); // play Tetris
break;
case ESCAPE_KEY:
return 0; // exit game
}
system("cls");
}
return 0;
}