Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- //reserve seat, seat #, 30 2-3 seatseconomy class, 20 business clas, 10 first class 1
- //int seatplan(dataType seats[100][100],int rowNo,int colNo)
- int main()
- {
- //declaration
- char colNo, rowNo;//user seat input
- int row, col;//seatplan
- int seats[15][6];
- //executable
- cout<<"================== SEAT RESERVATION =================="<<endl
- <<"row [1-15], coloumn [A-D] "<<endl
- <<" ____"<<endl
- <<" _------_"<<endl
- <<" __________"<<endl;
- for(rowNo= 0; rowNo<15; rowNo++)
- {
- for(colNo = 0; colNo <6; colNo++)
- seats [rowNo][colNo] = 'O';
- };
- for(row=0 ; row<15; row++)
- {
- if(row==0)
- { cout<<" | A B |"<<endl;}
- if(row==5)
- { cout<<" |A B C D|"<<endl;}
- if(row==10)
- { cout<<" |ABC DEF|"<<endl;}
- for(col=0 ; col <30; col++)
- {
- if (row<=9&&col==14)
- {
- cout<<row;
- }
- if (row>9&&col==13)
- {
- cout<<row;
- }
- if ((row>=0&&row<=4)&&(col<=13 || col==17 || col==19 || col==28 || (col>=21&&col<=26)))
- {
- cout<<" ";
- }
- if ((row>=5&&row<=9)&&(col<=13 || col==14 || col==28 || (col>=21&&col<=25)))
- {
- cout<<" ";
- }
- if ((row>=10&&row<=14)&&(col<=12||col==14||(col>=23&&col<=26)))//(col>=21&&col<=25))
- {
- cout<<" ";
- }
- if (col==18||col==29)
- {
- cout<<"|";
- }
- if ((row>=0&&row<=4)&&(col==20||col==27))
- {
- cout<<seats[rowNo][colNo];
- }
- if ((row>=5&&row<=9)&&(col==20||col==21||col==27||col==28))
- {
- cout<<seats[rowNo][colNo];
- }
- if ((row>=10&&row<=14)&&((col>=20&&col<=22)||(col>=27&&col<=29)))
- {
- cout<<seats[rowNo][colNo];
- }
- }//for end
- cout<<endl;
- }//for end
- }//seasts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement