I have been working on this for a few days now and I am having trouble understand how to create a paralell array between the seatList and seatPrices so the user can reserve that seat. I was wondering is someone could explain how it would work so I can write the code?

Thanks

//Paul Michaud
//Final Project
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;


//Global Variables
const int SEATING_CHART = 1,            //menu options
              EMPTY_SEATS = 2,
              EMPTY_CLASS_SEATS = 3,
              RUNNING_TOTAL = 4;


const int ROWS = 15;                    //Price Tier Rows
const int COLS = 6;                     //Price Tier Columns
int priceTier[ROWS][COLS];              //Array for price iter

const char SEAT_ROWS = 15;              //seating row const
const char SEAT_COLS = 6;               //seating column const
int seatList[SEAT_ROWS][SEAT_COLS];     //Array for seating chart

double sales[ROWS][COLS];               //Array for total sales

ifstream inputFile;                     //Declare inputFile to read in SalesPrice.txt

//function prototypes
int showMenu(int);                      //show menu choices
void getSeatingChart(int[][COLS], int);  //display the eating chart, get user seat choice
void getEmptySeats(int [][COLS], int);  //display empty seats in a row
int getEmptyClassSeats(int[][COLS], int);   //display empty seats in each class
double getTotalSales(double [][COLS], int);  //get the toal sales from plane (running total)

int main()
{
    //variables
    int choice, test, sample,x, y;
    char again;                           //repeat menu option

    //import the seat prices
    int r,c, count = 0;
    ifstream inputFile;

    inputFile.open("SeatPrices.txt");    //open the file

    for(int r = 0; r < ROWS; r++)
    {
        for(int c = 0; c < COLS; c++)
        {
            inputFile >> priceTier[r][c];
        }
    }

do {
    //step one get menu
    choice = showMenu(choice);

    //use choice to run through options
    if (choice == SEATING_CHART)
    {
        getSeatingChart(seatList, ROWS);

        cout << seatList;
    }
    else if(choice == EMPTY_SEATS)
    {
        getEmptySeats(seatList, ROWS);
    }
    else if(choice == EMPTY_CLASS_SEATS)
    {
        getEmptyClassSeats(seatList, ROWS);
    }
    else if(choice == RUNNING_TOTAL)
    {
        getTotalSales(sales, ROWS);
    }
    else
    {
        cout << "Please try again";
    }

    //repeat menu option
    cout << "\nDo you want to see more choices? (y/n)";
    cin >> again;
    cout << endl;
}while(again == 'y' || again =='Y');

    //close the file
    inputFile.close();

    return 0;

}

//***********************************
//Function definition for showMenu  *
//display all the menu option       *
//take an int for choice and return *
//***********************************
int showMenu(int)
{
    int choice;

    cout << "Welcome, Please choose an option from below: " << endl;
    cout << "1. View and reserve a seat(s)\n"
         << "2. View total empty seats in a row\n"
         << "3. View the empty seats in each class\n"
         << "4. View the total sales for the flight\n"
         << "Please enter your choice: ";
         while(choice < 1 || choice > 4 )
            {
                cin >> choice;
                cout << endl;
            }

    return choice;
}

//**********************************************
//Function definition for getSeatingChart      *
//display the seating chart from file          *
//stores data into a double array and return   *
//**********************************************
void getSeatingChart(int prices[][COLS], int row)
{

    //display the taken and reserved seats
    cout << "Col   " << "1" << "2" << "3";
    cout << "4" << "5" << "6" << endl;
    for (int r = 0; r < row; r++)
    {
        cout << "Row " << (r+1) << " " ;

        for (int c = 0; c < COLS; c++)
        {
            cout << "#";
        }
        cout << endl;
    }
    cout << endl;
}

//*************************************************
//Definitio for getEmptySeats                     *
//Display the number of empty seats in each row   *
//*************************************************

void getEmptySeats(int emptySeats[][COLS], int row)
{
    for(int count = 0; count < row; count++)
    {
        //set accumulator
        int total = 0;

        //sum a row
        for (int col = 0; col < COLS; col++)
        {
            total += emptySeats[row][col];
        }

        cout << "The total empty seats for row " << (count + 1)
        << " is " << total << endl;
    }

}

//*************************************************
//Definitio for getEmptySeats                     *
//Display the number of empty seats in the plane  *
//*************************************************

int getEmptyClassSeats(int emptyClass[][COLS], int row)
{
    cout << "This is to test getEmptyClassSeats" << endl;

    int x = 1;

    return x;
}

//******************************************
//Definitio for getTotalSales              *
//Display the total sales for the flight   *
//******************************************

double getTotalSales(double sales[][COLS], int row)
{
    double total;

    for(int x = 0; x < row; x++)
    {
        for(int y = 0; y < COLS; y++)
            total += sales[row][COLS];
    }

    cout << "The total sales for the plane is: $" << total << endl;

    return total;

}

I think you should use multi-dimentional array which can resolve your problem.

Unfortunately, I haven't learned classes or structures yet. But the multi dimensinal array helped. Thanks everyone

This question has already been answered. Start a new discussion instead.