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
|
#include<stdio.h>
#include<conio.h>
#include<iostream>
main()
{
char s[4]={'A','B','C','D'},p,b;
int a,c,x,y,seat[5][4];
do
{
system("cls");
printf("Please enter the seats to be reserved: ");
scanf("%d%c", &a,&b);
for(y=0;y<5;y++)
{
printf("\n\n");
for(x=0;x<4;x++)
{
if(y==a-1&&s[x]==b)
{
if(seat[y][x]==1)
printf("\nSELECTED SEAT IS ALREADY TAKEN");
else
{
seat[y][x]=1;
c=1;
printf("\nSeat %d%c is now reserved",y+1,s[x]);
}
}
else if(seat[y][x]==1&&c==1)
printf("\n\t\tSeat %d%c is TAKEN",y+1,s[x]);
else
printf("\nSeat %d%c is available",y+1,s[x]);
}
}
getch();
printf("\n\nDo you want to try again? Y/N ");
scanf("%s", &p);
}
while(p!='N');
return 0;
}
|