1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <iostream>
#include <iomanip>
using namespace std;
void getdata1(char &row, int &col);
void UpdatedSuperior(int SCLASS[4][6],char row, int col);
int main()
{
int col,SCLASS[4][6]={0};
char row;
getdata1(row,col);
UpdatedSuperior(SCLASS,row,col);
system("pause");
}
void getdata1(char &row, int &col)
{
int i=0,seat_require=0;
cout<<"How many seat required: ";
cin>>seat_require;
for(i;i<seat_require;i++){
cout<<"Please select your seat: ";
cin>>row>>col;
row = static_cast<char>(toupper(row));
}
cout<<endl;
}
void UpdatedSuperior(int SCLASS[4][6],char row, int col)
{
unsigned char a1 = static_cast<char>(218);
unsigned char a2 = static_cast<char>(179);
unsigned char a3 = static_cast<char>(196);
unsigned char a4 = static_cast<char>(191);
unsigned char a5 = static_cast<char>(194);
unsigned char a6 = static_cast<char>(197);
unsigned char a7 = static_cast<char>(195);
unsigned char a8 = static_cast<char>(180);
unsigned char a9 = static_cast<char>(192);
unsigned char a10 = static_cast<char>(193);
unsigned char a11 = static_cast<char>(217);
int sum[4]={0},seat[4]={0},seat1=0,sum1=0;
double seatrate=0;
char ascii='A';
cout<<" Seat Occupancy"<<a3<<"Superior Class\n"<<endl;
for(int num=1;num<7;num++)//display top number line
{
cout<<" "<<"0"<<num;
}
cout<<" "<<"Seats Available"<<endl;
cout<<endl;
cout<<" "<<a1;
for(int top=0;top<5;top++)//display top straight line cover
{
cout<<a3<<a3<<a3<<a3<<a5;}
cout<<a3<<a3<<a3<<a3<<a4;
cout<<" "<<"---------------"<<endl;
SCLASS[static_cast<int>(row)-65] [col-1]=1;
for(int i=0;i<4;i++){
cout<<ascii++<<" "<<a2;
for(int j=0;j<6;j++){
cout<<" "<<SCLASS[i][j]<<" "<<a2;
sum[i]+=SCLASS[i][j];
sum1+=SCLASS[i][j];
}
cout<<" "<<6-sum[i];
if(i==3)
goto stop;
cout<<endl;
cout<<" "<<a7;
if(i==0){
for(int i=0;i<5;i++){
cout<<a3<<a3<<a3<<a3<<a6;}
cout<<a3<<a3<<a3<<a3<<a8<<endl;
}
if(i==1){
for(int i=0;i<5;i++){
cout<<a3<<a3<<a3<<a3<<a10;}
cout<<a3<<a3<<a3<<a3<<a8<<endl;
cout<<" "<<a2<<" aisles "<<a2<<endl;
cout<<" "<<a7;
for(int j=0;j<5;j++){
cout<<a3<<a3<<a3<<a3<<a5;}
cout<<a3<<a3<<a3<<a3<<a8<<endl;
}
if(i==2){
for(int j=0;j<5;j++){
cout<<a3<<a3<<a3<<a3<<a6;
}
cout<<a3<<a3<<a3<<a3<<a8<<endl;}
}
stop:
{
cout<<endl;
cout<<" "<<a9;
for(int j=0;j<5;j++)
cout<<a3<<a3<<a3<<a3<<a10;
cout<<a3<<a3<<a3<<a3<<a11<<endl;
seatrate=(100*sum1/24);
cout<<endl;
cout<<" Occupancy rate: "<<seatrate<<"%"<<" "<<"Total Seats Available: "<<24-sum1<<endl;
}
}
|