-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
52 lines (48 loc) · 1.54 KB
/
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
47
48
49
50
51
52
#include "main.h"
int main(){
int loop = 1;
char c = '\0';
printf(WELCOME_MESSAGE);
while( loop ) {
printf("\n%s", ENTER_COMMAND);
printf("\nCommands: "DISPLAY_MANAGERS_COMMAND", "DISPLAY_PLAYERS_COMMAND", "DISPLAY_PLAYERS_TEAMS_COMMAND", "DISPLAY_TEAMS_COMMAND", "DISPLAY_TEAMS_MANAGERS_COMMAND", "DISPLAY_GAMES_COMMAND", "DISPLAY_TOTAL_MATCHES_COMMAND", "CREATE_TABLES_COMMAND" : ");
scanf(" %c", &c);
switch(c) {
case 'm':
display_managers();
break;
case 'p':
display_players();
break;
case 'r':
display_players_and_teams();
break;
case 't':
display_teams();
break;
case 'u':
display_teams_and_managers();
break;
case 'g':
display_matches();
break;
case 'n':
display_number_of_soccer_matches();
break;
case 'c': ;
status error_code = create_tables();
if (error_code != E_SUCCESS){
printf(ERROR_TEXT_ABORT);
}
break;
case 'q':
printf("%s\n", QUITING_COMMAND);
loop = 0;
break;
default:
printf("%s\n", INVALID_COMMAND);
break;
}
}
return 0;
}