Airplane program help

Hello everybody!
I have this program that it takes the input of row and seat of the user and displays a list of the rows taken in an airplane.
1 AB CD
2 AB CD
3 AB CD
4 AB CD
5 AB CD
6 AB CD
7 AB CD

Once the user inputs a row and a seat it places an X on the place.

They all work up, except row 1 and 2. It is a pretty simple fix but I can't get to find it.
Any help would be really appreciated.
Here is a copy of the code

#include <iostream>
#include <string>

using namespace std;
int main()
{
char Seat = ' ';
string Airline[7] = {"1ABCD", "2ABCD", "3ABCD", "4ABCD", "5ABCD", "6ABCD", "7ABCD"};
char Again = ' ';
int Row =0;

Again = 'y';

while(Again == 'y')
{
cout << "Enter a row: ";
cin >> Row ;
cout << "Enter a seat: ";
cin >> Seat;
Row = Row -2;

int idx = 1 + Seat - 'A';
if(Airline[Row][idx] == 'X') { //checks if seat is taken or not
cout << "Seat is taken." << endl;
continue; }
else
Airline[Row][idx] = 'X';
cout << "Enter another seat? (y/n): ";
cin >> Again;

for(int i=0; i<7; ++i)
{
cout << Airline[i] << endl;
}

} //end while
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
#include <iostream>
#include <string>

using namespace std;

int main()
{
	char Seat = ' ';
	string Airline[7] = {"1ABCD", "2ABCD", "3ABCD", "4ABCD", "5ABCD", "6ABCD", "7ABCD"};
	char Again = ' ';
	int Row =0;

	Again = 'y';

	while(Again == 'y')
	{
		cout << "Enter a row: ";
		cin >> Row ;
		cout << "Enter a seat: ";
		cin >> Seat;
		Row = Row -1;

		int idx = 1 + Seat - 'A';
		if(Airline[Row][idx] == 'X') { //checks if seat is taken or not
			cout << "Seat is taken." << endl;
			continue;
		}
		else
			Airline[Row][idx] = 'X';
		cout << "Enter another seat? (y/n): ";
		cin >> Again;

		for(int i=0; i<7; ++i)
		{
			cout << Airline[i] << endl;
		}

	} //end while
}


Notice line 21
Topic archived. No new replies allowed.