Hi
Once again a newbie posting the same homework assignment! I´ve searched alot for this problem but I´m probably not good enough in searching because I just can´t figure this out. My main problem now is to insert the airplane layout into the 2D array. I was trying to do it via double for loop but it seems to give me an "error C2440: '=' : cannot convert from 'char' to 'char [5]'"
I know that I´m just starting but plz give me some hints, you probably don´t believe how many hours I´ve been looking at this without getting anywhere.
The airplane layout should look out like this
1 A B C D
2 A B C D
3 A B C D
...
7 A B C D
btw. the cout is just for me to see how it looks like.
Thx.
Gottlieb.
#include <iostream>
#include <cctype>
#include <iomanip>
using namespace std;
const int SEATROWS = 7;
//void insertSeats (char seats[][5], int SEATROWS);
void insertSeats (char [][5]);
int main ()
{
char seats [7][5];
//insertSeats (seats, SEATROWS);
//cout << seats [0][0]<< endl;
insertSeats (seats);
system("PAUSE");
return 0;
}
void insertSeats (char seats [][5])
{
int row = 1;
char A;
for (int i = 0; i < SEATROWS; i++)
{
cout << row << " ";
seats [i] = '1';
row++;
for (int j = 0; j < 4; j++)
{
if (j == 0)
cout << 'A' << " ";
seats[j] = A;
if (j == 1)
cout << 'B'<< " ";
if (j == 2)
cout << 'C'<< " ";
if (j == 3)
cout << 'D'<< " ";
//cout << seats[i][j];
}
cout << endl;
}
}
/*void insertSeats (char seats [][5], int SEATROWS)
{
int row = 1;
char A = 'A';
char B = 'B';
for (int i = 0; i < SEATROWS; i++)
{
cout << row << " ";
//seats [i] = '1';
row++;
for (int j = 0; j < 4; j++)
{
//seats [j] = 'A';
if (j == 0)
cout << 'A' << " ";
seats[j] = A;
if (j == 1)
cout << 'B'<< " ";
if (j == 2)
cout << 'C'<< " ";
if (j == 3)
cout << 'D'<<" ";
//cout << seats[i][j];
}
cout << endl;
}
}*/