the Number For Ther Select Seat Row //the Seat Number //the Number For The Selected Letter
the Number For Ther Select Seat Row //the Seat Number //the Number For The Selected Letter
char seat[7]
[5]={'1','A','B','C','D','2','A','B','C','D','3','A','B','C','D','4','A','B
','C','D','5','A','B','C','D','6','A','B','C','D','7','A','B','C','D'};
char option,seatAlp;
int i,j;
int ExitYesNo=1;
int Row;//the number for ther select seat row
int Column;//The seat number
int seatNum;//The number for the selected letter
void main()
{
std::cout<<"\nWelcome To Air-Asia.";
std::cout<<"\n--------------------------------------\n";
for (i=0; i<7; i++)
{
std::cout<<"\n";
for(j=0;j<=4;j++)
std::cout<<seat[i][j]<<"\t";
}
std::cout<<"\n--------------------------------------\n";
for ( ;ExitYesNo=1; )
{
std::cout<<"\nPLease Enter Your Desired Seat Location: ";
std::cin>>seatNum;
std::cin>>seatAlp;
//Gets the numer of the seat selected, 1,2,3,4,5,6, or 7
switch (seatNum)
{
case 1:
Row=0;
break;
case 2:
Row=1;
break;
case 3:
Row=2;
break;
case 4:
Row=3;
break;
case 5:
Row=4;
break;
case 6:
Row=5;
break;
case 7:
Row=6;
break;
default:
Row=8;
std::cout<<"\nInvalid Input";
break;
if (seat[Row][Column]=='X')
std::cout<<"\nWe Are Sorry To Inform You That Your
Desired Seat Location Is No More Avialable\n";
seat[Row][Column]='X';
std::cout<<"\nThank You For Flying Air-Asia : \n";
for (i=0;i<7;i++)
{
std::cout<<"\n";
for(j=0;j<=4;j++)
std::cout<<seat[i][j]<<"\t";
}
//Choose Another seat location for a friend or
family member
std::cout<<"\n--------------------------------------";
std::cout<<"\nDo You Wish To Choose Another Seat For A
Friend Or Family Member?\n";
std::cout<<"Enter -> 'Y' To Continue\n\t-> 'N' To Exit ";
std::cin>>option;
switch (option)
{
case 'y': case 'Y'://Proceed to choose another seat
ExitYesNo=1;
break;
case 'n': case 'N'://stop
ExitYesNo=0;
break;
default:
std::cout<<"Invalid Input"<<std::endl;
break;
std::cout<<"\n--------------------------------------";
}
system("PAUSE");
}