For some reason, my program will not let the user enter his/her row number. Here's the code:
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
int a=0,A=0,b=1,B=1,c=2,C=2,d=3,D=3,e=4,E=4,f=5,F=5;
void ticketchoices();
void displaychartfirst(char firstclass[2][6],int ticketnumselection);
void displaychartbus(char busiclass[5][6],int ticketnumselection);
void displaycharteco(char ecoclass[6][6],int ticketnumselection);
int main(int argc, char *argv[])
{
char X;
char O;
char firstclass[2][6]={{'O','O','X','O','X','X'}, //first class array.
{'O','X','O','X','O','X'}};
char busiclass[5][6]= {{'O','O','X','X','O','X'}, //business class array.
{'X','O','X','O','X','X'},
{'O','X','O','X','O','O'},
{'O','X','O','O','O','X'},
{'X','O','O','O','X','X'}};
char ecoclass[6][6]= {{'O','X','O','X','X','O'}, //economy class array.
{'X','O','X','X','O','X'},
{'O','X','O','X','X','X'},
{'O','O','X','O','X','O'},
{'O','O','X','X','O','X'},
{'O','O','O','O','X','O'}};
int ticketnumselection;
cout<<"Welcome! Please, select a ticket type:"<<endl;
ticketchoices();
cout<<endl;
cout<<"Enter choice: ";
cin>>ticketnumselection;
cout<<endl;
switch(ticketnumselection)
{case 1: cout<<"You've chosen first class."<<endl<<endl;
break;
case 2: cout<<"You've chosen business class."<<endl<<endl;
break;
case 3: cout<<"You've chosen economy class."<<endl<<endl;
break;}
displaychartfirst(firstclass,ticketnumselection);
displaychartbus(busiclass,ticketnumselection);
displaycharteco(ecoclass,ticketnumselection);
int sr1,sc1,sr2,sc2,sr3,sc3;
if(ticketnumselection==1)
{
cout<<"Please, enter your seat position, below (Example: A2):"<<endl;
cout<<"Enter seat letter: ";
cin>>sc1;
}
if(ticketnumselection==1)
{
cout<<"Enter row number: ";
cin>>sr1;
}
if(ticketnumselection==2)
{
cout<<"Please, enter your seat position, below (Example: C3):"<<endl;
cout<<"Enter seat letter: ";
cin>>sc2;
cout<<"Enter row number: ";
cin>>sr2;
}
if(ticketnumselection==3)
{
cout<<"Please, enter your seat position, below (Example: D11):"<<endl;
cout<<"Enter seat letter: ";
cin>>sc3;
cout<<"Enter row number: ";
cin>>sr3;
}
system("PAUSE");
return EXIT_SUCCESS;}
void ticketchoices()
{cout<<"Press 1 to select first class."<<endl;
cout<<"Press 2 to select business class."<<endl;
cout<<"Press 3 to select economy class."<<endl;
return;}
void displaychartfirst(char firstclass[2][6], int ticketnumselection)
{
int r=0,c=0;
if(ticketnumselection==1)
{cout<<" A B C D E F"<<endl<<endl;
for(r=0;r<2;++r)
{ if(r>=1)
{cout<<endl;}
cout<<"Row "<<r+1<<" ";
for(c=0;c<6;++c)
{cout<<firstclass[r][c]<<" ";}}}
cout<<endl;
return;}
void displaychartbus(char busiclass[5][6],int ticketnumselection)
{
int r=0,c=0;
if(ticketnumselection==2)
{cout<<" A B C D E F"<<endl<<endl;
for(r=0;r<5;++r)
{ if(r>=1)
{cout<<endl;}
cout<<"Row "<<2+r+1<<" ";
for(c=0;c<6;++c)
{cout<<busiclass[r][c]<<" ";}}}
cout<<endl;
return;}
void displaycharteco(char ecoclass[6][6],int ticketnumselection)
{
int r=0,c=0;
if(ticketnumselection==3)
{cout<<" A B C D E F"<<endl<<endl;
for(r=0;r<6;++r)
{ if(r>=1)
{cout<<endl;}
cout<<"Row "<<7+r+1<<" ";
for(c=0;c<6;++c)
{cout<<ecoclass[r][c]<<" ";}}}
cout<<endl;
return;}