Spot the differences. Especially how you had two variables called "seat". The second one is now called: Seat (starts with a capital letter).
Code:
#include <iostream>
#include <cstring>
using std::endl;
using std::cout;
using std::cin;
//-- static const unsigned ROWS = 7;
static const unsigned COLS = 4;
//--------------------------------------------------------------------------- char seat[7][COLS];
int main()
{
for(unsigned i = 0; i < ROWS; ++i)
{
for(unsigned j = 0; j < COLS; ++j)
{
seat[i][j]= j+'A';
}
}
for(unsigned i = 0; i < ROWS; ++i)
{
cout<< (i+1);
for(unsigned j = 0; j < COLS; ++j)
{
cout<< " " << seat[i][j];
}
cout<< endl;
}
//Let's take seat at position [3,2]. Since indexes start at 0 we need to //substract 1: position = [3-1][2-1]. char Aisle; //for rows char Seat; //for coulumns
cout<< "Please enter your desired seat no. (eg, 3A): ";
cin >> Aisle >> Seat;
unsigned row = Aisle -'0' - 1; //to calculate the row unsigned col = Seat - 'A'; //to calculate the column
seat[row][col] = 'x';
cout<<endl<<"After taking a seat:"<<endl<<endl;
for(unsigned i = 0; i < ROWS; ++i)
{
for(unsigned j = 0; j < COLS; ++j)
{
cout<<seat[i][j];
}
cout<<endl;
}
//Remove the comment slashes below if your console "flashes away": //std::cin.get(); return 0;
}