Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (anonymous):

I need help with this code i am supposed to let the passenger choose the seat and display their name to the window

OpenStudy (anonymous):

#include <iostream> #include<string> using namespace std; int main() { //int option; char column, ticketType; int row,i,j; char form[13][4]; string name; cout<<"this plane has 13 rows with 4 seats in each row"<<endl; cout<<"enter ticket type: "; cout<<"F for first class"<<endl; cout<<"B for business class"<<endl; cout<<"E for economy class"<<endl; cin>>ticketType; switch(ticketType) { case 'F': cout<<"row 1 and 2 are first class"<<endl; break; case 'B': cout<<"row 3 through 7 are business class"<<endl; break; case 'E': cout<<"row 8 throguh 13 are economy class"<<endl; break; } cout<<"enter the row number you want to sit: "<<endl; cin>>row; cout<<"enter the seat number you want to sit (A to D)"<<endl; cin>>column; cout<<"enter the name that you would like to be reserved: "; cin>>name; if(form[row-1][static_cast<int>(column-65)]=='name') { cout<<"this seat is already taken"; cout<<"choose another seat"<<endl; } form[row-1][static_cast<int>(column-65)]='name'; cout<<"* indicates that the seat is available"; cout<<"X indicates that the seat is not available"<<endl; cout << setw(12) << "A" << setw(4) << "B" << setw(4) << "C" << setw(4) << "D" << setw(4) << endl; for(i=0;i<13;i++) cout << left << setw(3) << "Row " << setw(2)<< i+1 ; for(j=0;j<4;j++) cout << right << setw(6) << form [i][j]; cout<<endl; /*cout<<"------------------------------------------"<<endl; cout<<"Flight BombardierCJR200 Information"<<endl; cout<<"1: Flight Information"<<endl; cout<<"2: buy a ticket"<<endl; cout<<"3: display plane manifest"<<endl; cout<<"4: store flight and passenger information"<<endl; cout<<"------------------------------------------<<endl; switch(option) { case 1: case 2: case 3: case 4: default: cout<<"That was not one of the options please choose again"<<endl; }; */ cout<<"The Flight Information for the Bombardier CJR200 is:"<<endl; cout<<"Location: India"<<endl; cout<<"Time of flight: May/21/2013 8:00 A.M."<<endl; cout<<"Arrival: May/23/21013 12:50 A.M."<<endl; cout<<"The Seat layout of the Bombardier CJR200:"<<endl; cout<<"A1 B1 C1 D1"<<endl; cout<<"A2 B2 C2 D2"<<endl; cout<<"A3 B3 C3 D3"<<endl; cout<<"A4 B4 C4 D4"<<endl; cout<<"A5 B5 C5 D5"<<endl; cout<<"A6 B6 C6 D6"<<endl; cout<<"A7 B7 C7 D7"<<endl; cout<<"A8 B8 C8 D8"<<endl; cout<<"A9 B9 C9 D9"<<endl; cout<<"A10 B10 C10 D10"<<endl; cout<<"A11 B11 C11 D11"<<endl; cout<<"A12 B12 C12 D12"<<endl; cout<<"A13 B13"<<endl; return 0; }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!