Code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
int main()
{
int seats[SIZE]= {0};
int select, i=0, k = 5, cnt;
static int I=0, K=10;
char yn;
while ((( I < 5 ) || ( k < 10))){
printf( "\nPlease type 1 for First Class."
"\nPlease type 2 for Economy Class.");
scanf ("%d", &select );
if ( select == 1 ) {
if ( I > 4 ){
printf( "Sorry first class is taken do you need economy class[y/n]: ");
scanf ("%s", &yn );
if ( yn == 'y' ){
printf ("\nEconomy Class. Seat number %d\n", k+1 );
++seats[k++];
}
else if ( yn == 'n' ) {
printf ("\nNext Flight leaves in 3 hours\n");
break;} }
else {
printf ("\nFirst Class .Seat number %d\n", I+1 );
++seats[i++];
I++; }
}
else if ( select == 2 ){
if ( K > 10 ){
printf ("\nNow there arnt any seats for economy class\n");
}
else {
printf ("\nEconomy Class. Seat number %d\n", k+1 );
++seats[k++];
K = k+1;}}
}
printf( "----------VIRGIN ATLANTIC----------\n"
" No more seats are avaiable\n"
"----------From 1980 to 2002--------\n");
system("PAUSE");
return 0;
}
Here is the code u need ....