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
|
#include <iostream>
#include <cctype>
using namespace std;
int main(){
char grid[12][11] = {
{' ','A','B','C','D','E','F'},
{'1','O','O','O','O','O','O'},
{'2','O','O','O','O','O','O'},
{'3','O','O','O','O','O','O'},
{'4','O','O','O','O','O','O'},
{'5','O','O','O','X','O','O'},
{'6','O','O','O','O','X','O'},
{'7','O','O','O','O','O','O'},
{'8','O','O','O','O','O','O'},
{'9','O','O','O','O','O','O'},
{'1','O','O','O','O','O','O'}};
char character = 'X';
int position[10] = {11,11};
int row;
char col;
// Draw the grid once
for (int i =0; i < 11; i ++){
for (int j =0; j < 11; j++){
cout << grid[i][j];
cout << " ";
}
cout << endl;
}
bool seatBooked=false;
do
{
cout<< "\nEnter Column Letter = ";
cin >> col;
cout<< "Enter Row Number = ";
cin >> row;
//Draw grid based on user choice
if ((row== 5 && col== 'D') || (row=6 && col=='E'))
cout<<"This seat has been taken, Please enter a new seat number:\n";
else
grid[row][col]
= 'X';
}while(!seatBooked);
system ("cls");
for ( i =0; i < 10; i ++){
for (int j =0; j < 10; j++)
{
cout << grid[i][j];
cout << " ";
}
cout << endl;
grid [row][col - 'A' + 1] = character;
}
return 0;
}
|