i have here a code.....
can anybody tell me how to:-O change the '*' to 'X' when a user will input his desired seat.....
:(
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
int userInput();
int main()
{
clrscr();
int x,y;
const int row= 12,seat= 5;
char plane[row][seat];
cout<<"\t\tAirplane Seat Arrangement"<<endl;
cout<<"\tA\tB\tC\tD\tE\tF"<<endl;
{for (y=1;y<=13;y++)
{ cout<<"Row "<<y<<"\t";
{for(x=0;x<=5;x++)
{ plane[y][x]='*';
cout<<plane[y][x]<<"\t";
}
cout<<endl;
}
}
}
userInput();
cout<<"Congratulations!! You Now Have A Seat...."
<<" Happy Trip!!!";
getch();
return 0;
}
int userInput()
{int tt,tr,nsa;
int a,b;
const int row= 12,seat= 5;
char plane[row][seat];
char tc;
char A=1;
char B=2;
char C=3;
char D=4;
char E=5;
char F=6;
cout<<"\nEnter TICKET TYPE [1]First Class [2]Economy Class : ";
cin>>tt;
switch(tt)
{case 1:
{
{cout<<"Enter TICKET [1-2]ROW NUMBER : ";
cin>>tr;
{ if ((tr>=1)&&(tr<=2))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl;
cout<<"Note : Letter is CASE SENSITIVE!!!"<<endl;
cout<<"Enter TICKET [A-F]COLUMN LETTER : ";
cin>>tc;
if ((tc>='A')&&(tc<='F'))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl; }
}
{
for (a=0;a<=2;a++)
for (b=0;b<=5;b++)
plane[a][b] ='X'; }
cout<<plane[a][b];
}
break;
case 2:
{cout<<"[1]Non-Smoking Area [2]Smoking Area : ";
cin>>nsa;
switch(nsa)
{case 1:
{cout<<"Enter TICKET [3-7]ROW NUMBER : ";
cin>>tr;
{ if ((tr>=3)&&(tr<=7))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl;
cout<<"Note : Letter is CASE SENSITIVE!!!"<<endl;
cout<<"Enter TICKET [A-F]COLUMN LETTER : ";
cin>>tc;
if ((tc>='A')&&(tc<='F'))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl;
} }break;
case 2:
{cout<<"Enter TICKET [8-13]ROW NUMBER : ";
cin>>tr;
{ if ((tr>=8)&&(tr<=13))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl;
cout<<"Note : Letter is CASE SENSITIVE!!!"<<endl;
cout<<"Enter TICKET [A-F]COLUMN LETTER : ";
cin>>tc;
if ((tc>='A')&&(tc<='F'))
cout<<"Input Accepted..."<<endl<<endl;
else
cout<<"Invalid Input!!!"<<endl<<endl;
}break;
default:
cout<<"INVALID INPUT!!!"<<endl;break;
} }
}
default:
cout<<"INVALID INPUT!!!"<<endl;break;
}
return userInput();
}