-
Notifications
You must be signed in to change notification settings - Fork 0
/
Airline_Reservation.c
84 lines (84 loc) · 2.28 KB
/
Airline_Reservation.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
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main(void)
{
int c,p;
int i;
int j;
int s[10]={};
printf("**Welcome to Simple Airline Seat Reservations System**\n\n");
for (j=0; j<10; j++)
{
printf("Choose 1 for First Class and 2 for Economic class\t");
scanf("%i",&c);
//system("cls");
switch(c)
{
case 1:
printf("\nFirst class\n");
printf("Seats available are 1,2,3,4,5.\n");
do
{
printf("Pick a seat:\n\n");
scanf("%i",&p);
s[j]=p;
//system("cls");
for (i=0; i<j; i++)
{
if (s[j]==s[i])
{
printf("\n\nSeat taken.\n\n");
break;
}
}
}
while (i!=j);
if(s[j] <= 5)
{
printf("\n");
printf("--------------------------\n");
printf("Class: First class\n");
printf("Seat no : %i\n",s[j]);
printf("--------------------------\n\n");
}
else
printf("\nWrong number! No seat for you!\n\n");
break;
case 2:
printf("\nEconomical class\n");
printf("Seats available are 6,7,8,9,10.\n");
do
{
printf("Pick a seat:\n\n");
scanf("%i",&p);
s[j]=p;
//system("cls");
for (i=0; i<j; i++)
{
if (s[j]==s[i])
{
printf("\n\nSeat taken.\n\n");
break;
}
}
}
while (i!=j);
if(s[j] >= 6)
{
printf("\n");
printf("--------------------------\n");
printf("Class: Economical class\n");
printf("Seat no : %i\n",s[j]);
printf("--------------------------\n\n");
}
else
printf("\nWrong number! No seat for you!\n\n");
break;
default:
break;
}
}
return 0;
}