Array Values

i have set up an array that is printed to the screen.
it consists of 4 columns and 6 rows, all of which are set to 0.

i need to change these values seperatley (airline booking project again).so far the program takes the customer name and i wish to enter any seat number (column/row) and have the value change on screen. i have poor knowledge of arrays and welcome any suggestions/help with this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const int ROW = 6;
const int COLUMN = 4;
void Seat()
{
     char forename[20];
     char surname[20];
     cout << "Please Enter customers Forename" << endl;
     cin >> forename;
     cout << "Please Enter customers Surname :" << endl;
     cin >> surname;
     cout << "Please select seat to reserve/book" << endl;
     int i,j;
     int seatlayout[6][4] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     cout << "\n\n\n";
     cout << "\t\tCOLUMN\n";
     cout << "\tA" << "\tB" << "\tC" << "\tD" << endl;
     for (i=0;i<ROW;i++)
     {
     cout << "\nROW "<<i+1;
     for (j=0;j<COLUMN;j++)
     cout << "\t" << seatlayout[i][j];
     }     
};


thanks J
Wel, first of all, there is an easier way to initialize the values:
1
2
3
4
5
for (int i=0;i<6;i++)
{
    for (int j=0;j<4;j++)
         seatlayout[i][j]=0;
}


Secondly, I dont understand what you're trying to do. What does the array mean? If it should hold a customer name, it should be string. You could use someting like this:
1
2
3
4
5
6
7
8
9
10
cout<<"Name?";
cin>>name; //use getline in reall program!
cout<<"Row?";
cin>>row; //same here, getline()
cout<<"column?";
cin>>column; //getline()...
if (seat[row][column] != "")
    cout<<"Taken!";
else
    seat[row][column]=name;


And where you declare seatlayout[6][4] I think it should be seatlayout[ROW][COLUMN]
@Scipio: Wel (notice my spelling mistake too ;)), first of all, there is an easier way to initialise the values:
int seatlayout[6][4] = {0};

@Jonatello: http://www.cplusplus.com/forum/articles/6046/
Topic archived. No new replies allowed.