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
|
#include<stdio.h>
#include<string.h>
#include<conio.h>
int main ()
{
int choice, x=0, y=0;
char seats[5][8] = {{'1','A', '1', 'B', '1', 'C', '1', 'D'},
{'2','A', '2', 'B', '2', 'C', '2', 'D'},
{'3','A', '3', 'B', '3', 'C', '3', 'D'},
{'4','A', '4', 'B', '4', 'C', '4', 'D'},
{'5','A', '5', 'B', '5', 'C', '5', 'D'}};
printf("\n\n\t\t\t\tAirplane Program");
printf("\n\n[1] Display the Seat Arrangement");
printf("\n[2] Input the Passenger's Choice");
printf("\n[3] Exit the Program");
printf("\n\nEnter Your Choice:\t");
scanf("%d", &choice);
int counter = 0;
if (choice == 1)
{
for (x=0; x<5; x++){
for(y=0; y<8; y++)
{
printf("%c", seats[x][y]);
if(counter == 1 || counter == 3 || counter == 5 || counter == 7) {printf(" ");}
counter++;
if(counter == 8){ printf("\n"); counter=0; };
}
}
}
getch();
}
|