-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
95 lines (93 loc) · 2.31 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
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
#include<string.h>
#include "header.h"
int main(void)
{
system("color Fc");
client_list *list = NULL;
u8 name[SIZE]={0};
u8 age[SIZE]={0};
u8 id[SIZE]={0};
u8 address[SIZE]={0};
u8 phone[SIZE]={0};
u8 seat_class[SIZE]={0};
u32 seat_no[SIZE]={0};
u32 i=0, j=0,k=0,l=0,choice=0;
list = CreateList();
main_menu();
while (1)
{
printf("What do you want to do? ");
scanf("%d",&i);
switch(i)
{
case 1:
ClientList(list);
break;
case 2:
printf("Enter the Client name: ");
fflush(stdin);
scanf("%s",name);
printf("Enter the client's age: ");
scanf("%s",age);
fflush(stdin);
printf("Enter the Client's ID: ");
scanf("%s",id);
fflush(stdin);
printf("Enter the client's address: ");
scanf("%s",address);
fflush(stdin);
printf("Enter the client's Phone Number: ");
scanf("%s",phone);
fflush(stdin);
printf("Enter the client's seat Class (A-B-C): ");
scanf("%s",seat_class);
fflush(stdin);
printf("Enter the Client's Seat number: ");
scanf("%s",seat_no);
fflush(stdin);
if(New_Client(list,name,age,id,address,phone,seat_class,seat_no) == RET_OK)
{
printf("Booking completed\n");
}
else
{
printf("Client was not added. Please, try again");
}
break;
case 3:
if(Delete_Client(list)==RET_OK)
{
printf("The Client has been deleted successfully\n");
}
else
{
printf("Please, try again later.\n");
}
break;
case 4:
if(Free_seats(list,&j)== RET_OK)
{
printf("The total registered clients are: %d\n",j);
printf("The total available seats are: %d seats\n",plane_size-j);
}
break;
case 5:
if(Client_Edit(list,&k,&l)==RET_OK)
{
printf("Client info has been updated");
}
break;
case 6:
printf("Exiting....");
free(list);
exit(0);
break;
case 7:
main_menu();
break;
default:
printf("You entered wrong number");
break;
}
}
}