-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
46 lines (34 loc) · 926 Bytes
/
main.c
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 <stdio.h>
#include <stdlib.h>
//game c files
#include "games/numberGuesser.c"
#include "games/sl.c"
char *gameNames[] = {"Number Guesser - by Avery", "SL - added by Erik Duxstad"};
int numGames = sizeof(gameNames) / sizeof(gameNames[0]);
int MAXINPUT = 1000;
int main() {
char input[MAXINPUT];
int i;
//printf("%d\n", atoi(input));
printf("\n\nWelcome to the Text Arcade!\nThis is a computer program that was written in C by members of the Programming Club at EPHS\n");
start:
do {
printf("\n\nSelect a game to play from the following list:\n");
for (i = 0; i < numGames; i++) {
printf("[%d]\t%s\n", i+1, gameNames[i]);
}
scanf("%s", input);
} while (atoi(input) <= 0 || atoi(input) > (0 + numGames));
//run game function
switch (atoi(input)) {
case 1:
//printf("Number guesser selected\n");
numberGuesser();
break;
case 2:
sl();
break;
}
goto start;
return 0;
}