I don't understand what getstream is about nor do i know how to change a certain part in an array to something else. please help me.

// **************************************************************************
//
// Airplane.cpp   
//
// Program that displays the seat diagram for an airplane and allows the user
// to select a seat.  If the seat is available, the program marks it as taken
// and displays a new diagram.  If the seat is not available, the program says
// so and asks for another selection.  The program terminates when the user
// asks to stop or all seats are taken.
// 
// **************************************************************************
#include <iostream>
#include <iomanip>

using namespace std;

const int NUMROWS = 8;
const int NUMSEATS = 5;

void initPlane(char plane[NUMROWS][NUMSEATS]);
// POSTCONDITION: 
//   plane[x][0] == 'A', 0<=x<=6
//   plane[x][1] == 'B', 0<=x<=6
//   plane[x][2] == 'C', 0<=x<=6
//   plane[x][3] == 'D', 0<=x<=6

void printPlane(char msg[], char plane[NUMROWS][NUMSEATS]);
// POSTCONDITION: The seating layout of the plane has been printed
// to the standard output with an X displayed for each taken seat.

void getSeat(char &row, char &seat);
// POSTCONDITION: 1 <= row <= 7, 'A' <= seat <= 'D'
// Note that getSeat does not check to see if the seat has been taken.

int main()
{
    int seatsTaken = 0;
    int seats = NUMROWS * NUMSEATS;
    char plane[NUMROWS][NUMSEATS];
    char keepGoing = 'y';
    char row, seat;
    int rowIndex, seatIndex;

    initPlane(plane);

    cout << "Choose your seat!" << endl;
    while (seatsTaken < seats && keepGoing == 'y')
    {
        //
        // Show layout and get seat choice
        // 
        printPlane("Plane layout; X designates taken seats", plane);
        cout << "Enter the row(1-7) and seat(A-D) you would like (e.g., 3D): ";
        getSeat(row, seat);

        //
        // Adjust input to use as indices
        //
        rowIndex = row;
        seatIndex = seat - 'A';

        //
        // Check to see if seat is taken
        // 
        if (plane[rowIndex][seatIndex] == 'X')
            cout << "Sorry, " << row << " " << seat << " is already taken." << endl;
        else
        {
            cout << "OK, you've got " << row << seat << endl;
            plane[rowIndex][seatIndex] = 'X';
            seatsTaken++;
        }

        //
        // If there are seats left, see if we should keep going
        // 

        if (seatsTaken < seats)
        {
            cout << "Choose another seat? (y/n) ";
            cin >> keepGoing;
        }
        else
            cout << "Plane is now full!" << endl;
    }
    
    printPlane("Final seating chart", plane);
    system("PAUSE");
}  



	// --------------------------------
	// ----- ENTER YOUR CODE HERE -----
	// --------------------------------
void initPlane(char plane[NUMROWS][NUMSEATS])
{
 plane[1][0] = 'A';
 plane[1][1] = 'B';
 plane[1][2] = 'C';
 plane[1][3] = 'D';
 plane[1][4] = ' ';
 plane[2][0] = 'A';
 plane[2][1] = 'B';
 plane[2][2] = 'C';
 plane[2][3] = 'D';
 plane[2][4] = ' ';
 plane[3][0] = 'A';
 plane[3][1] = 'B';
 plane[3][2] = 'C';
 plane[3][3] = 'D';
 plane[3][4] = ' ';
 plane[4][0] = 'A';
 plane[4][1] = 'B';
 plane[4][2] = 'C';
 plane[4][3] = 'D';
 plane[4][4] = ' ';
 plane[5][0] = 'A';
 plane[5][1] = 'B';
 plane[5][2] = 'C';
 plane[5][3] = 'D';
 plane[5][4] = ' ';
 plane[6][0] = 'A';
 plane[6][1] = 'B';
 plane[6][2] = 'C';
 plane[6][3] = 'D';
 plane[6][4] = ' ';
 plane[7][0] = 'A';
 plane[7][1] = 'B';
 plane[7][2] = 'C';
 plane[7][3] = 'D';
 plane[7][4] = ' ';
}
// POSTCONDITION: 
//   plane[x][0] == 'A', 0<=x<=6
//   plane[x][1] == 'B', 0<=x<=6
//   plane[x][2] == 'C', 0<=x<=6
//   plane[x][3] == 'D', 0<=x<=6

void printPlane(char msg[], char plane[NUMROWS][NUMSEATS])
{
     cout << msg << endl;
     int row,seat;
     for ( row = 1; row < NUMROWS; row ++)
     {
         if (row >= 1) 
         cout << row;
         if (row < 8)
         cout << " ";
         for (seat = 0; seat < NUMSEATS; seat++)
         cout << setw(2) << plane [row][seat] << " ";
         cout << endl;
         
     }


}
// POSTCONDITION: The seating layout of the plane has been printed
// to the standard output with an X displayed for each taken seat.

void getSeat(char &row, char &seat)
{
 
}
     
// POSTCONDITION: 1 <= row <= 7, 'A' <= seat <= 'D'
// Note that getSeat does not check to see if the seat has been taken.

	// --------------------------------
	// --------- END USER CODE --------
	// --------------------------------

i seriously donot understand which part of the code do you think is the problem and secondly .. What the problem is. Please Explain.

The getSeat part, and I don't know how to change a seat to an X.

getseat is to check that user input is valid:

set flag to true
while invalid row number
  ask user for row number of seat they want
  accept user input
  if user input is valid
    change flag to false

set flag to true
while invalid seat number (that is column number/character, whatever)
  ask user for seat number
  accept user input
  if user input is valid
    change flag to false

This sets the first seat in row 2 to the char A:

plane[1][0] = 'A';

How do you think you would change the value stored in the array to the char X?

Comments
i like your method of answering questions.
This article has been dead for over six months. Start a new discussion instead.