-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenus.c
96 lines (92 loc) · 2.47 KB
/
menus.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <stdio.h>
#include <stdlib.h>
#include "STD_types.h"
#include "config.h"
u32 MainMenu(u8 errorFlag){
system("cls");
if(errorFlag){
printf("\n*****************************************\n");
printf("Wrong choice.Please try again.");
printf("\n*****************************************\n");
}
u32 choice = 0;
printf("\n-----------------------\n");
printf("\tMain Menu");
printf("\n-----------------------\n");
printf("%d- Admin mode\n",ADMIN_MODE);
printf("%d- User mode\n",USER_MODE);
printf("%d- Exit",MAIN_MENU_EXIT);
printf("\n***********************\n");
printf("Enter your choice: ");
scanf("%d",&choice);
return choice;
}
u32 CheckPassword(u8 errorFlag){
u32 pass = 0;
static u32 tries = 0;
system("cls");
if(errorFlag){
printf("\n*****************************************\n");
printf("Wrong password. Please try again");
printf("\n*****************************************\n");
}
printf("\n------------------------------\n");
printf("\tValidation Menu");
printf("\n------------------------------\n");
printf("Enter your password: ");
scanf("%d",&pass);
switch(pass){
case 1234:
tries = 0;
return 1;
default:
if(tries < 2){
tries++;
errorFlag = 1;
return CheckPassword(errorFlag);
}
else{
return 0;
}
}
}
u32 AdminModeMenu(u8 errorFlag){
system("cls");
if(errorFlag){
printf("\n*****************************************\n");
printf("Wrong choice.Please try again.");
printf("\n*****************************************\n");
}
u32 choice = 0;
printf("\n-----------------------\n");
printf("\tAdmin Mode");
printf("\n-----------------------\n");
printf("1- Add new patient record\n");
printf("2- Edit patient record\n");
printf("3- Reserve a slot with the doctor\n");
printf("4- Cancel reservation\n");
printf("5- Return to MainMenu");
printf("\n***********************\n");
printf("Enter your choice: ");
scanf("%d",&choice);
return choice;
}
u32 UserModeMenu(u8 errorFlag){
system("cls");
if(errorFlag){
printf("\n*****************************************\n");
printf("Wrong choice.Please try again.");
printf("\n*****************************************\n");
}
u32 choice = 0;
printf("\n-----------------------\n");
printf("\tUser Mode");
printf("\n-----------------------\n");
printf("1- View patient's record\n");
printf("2- View today's reservations\n");
printf("3- Return to MainMenu");
printf("\n***********************\n");
printf("Enter your choice: ");
scanf("%d",&choice);
return choice;
}