So I need to come up with something like this: It's a layout of seats on an airplane.
1 A B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D
But instead my code prints this:
ABCD
ABCABCD
ABCABCD
ABCABCD
ABC
This is my code, any help would be really appreciated. I just started working with arrays
#include <iostream>
using namespace std;
int main ()
{
char airplane[7][4] = {{'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'}};
for (int i=0; i<4; i++)
{
for (int j=0; j<7; j++)
{
cout<<airplane[i][j];
if (airplane[i][j]=='D')
{
cout<<endl;
}
}
}
system ("PAUSE");
return 0;
}