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
|
int main()
{ const int x=7, y=4;
char seats[x][y] = {{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'}};
int row;
char seat;
cout<<"Unavailable seats are marked [X]."<<endl;
for ( int i=0; i<x; i++) // This loop is for rows.
{
cout<<i+1<<" ";
for (int j=0; j<y; j++) // This is for column
{
cout<<seats[i][j]<<" ";
}
cout<<endl;
cout<<endl;
}
cout<<"Enter a row :";
cin>>row;
cout<<"Enter a seat :";
cin>>seat;
seats[row][seat] = 'X';
return 0;
}
|