Need Help Writing a program

This program studies the 2D array. Design a program to allow a passenger to select an airline seat.
Text file seats.txt contains a chart of seats for an airline with 10 rows and 4 columns. Available seats are marked with character ‘.’ and taken seats with character ‘X’. The data will be read into a 2D array. The first two rows are first class and remaining rows are business class.



The program should make use of the following named constants. In this way, it can be quickly modified to work with a different airplane.

const int ROWS = 10; // number of rows
const int COLS = 4; // number of columns
const int FIRSTCLASSROWS = 2; // number of first class rows at front of plane


The program should implement the following functions. Do not alter the function headings and code should honor the PRE and POST comments.

void display (char seats[ ][COLS],int rows);
// POST: display the seating chart (see screen shot for desired output)

void purchase (char seats[ ][COLS],int rows);
// POST: allow the user to purchase a seat and mark seat as taken

void statistics (char seats[][COLS],int rows);
// POST: compute and display percent occupancy

bool availableFirstClass (char seats[ ][COLS],int nrows);
// PRE: nrows is the number of first class rows at front of plane
// POST: return true if a seat is available in first class; else false

void assignFirstClass (char seats[ ][COLS],int nrows, int& row, char& letter);
// PRE: nrows is the number of first class rows at front of plane
// POST: row and letter are set to an available first class seat
So what is your question?

We will not do your homework for you.
Post what code you have and specific questions and we will try and help.
Topic archived. No new replies allowed.