Hey guys,
I've been having a bit of trouble with my c++ program i'm trying to create for an assignment. I'm still learning, but array's seem to give me the most trouble. I've been reading and searching google alot to try and find examples to help my situation, but i'm not quite sure what i've done so far is correct especially with the array side of things. The program compiles correctly but when i go to test adding a passanger name it gives and unhandled exception error. The requirements for the assignment are:

"You are hired to develop a program to be used by airport staff to assign seats for a commercial airplane.
The airplane has 12 rows. Rows 1 and 2 are first class, rows 3 through 5 are business class, and rows 6 through 12 are economy class."
- You must define and implement a class Passenger to model passenger objects and you must use the class in your program.
- The data structure that is used to store Passenger objects must be array.
- The system must be a 2008 or 2010 Microsoft Visual Studio .NET Win32 console application implemented in C++.
- You may add more classes, if you wish.
- You may use any C++ standard libraries, if you wish.

And my code so far is (sorry i haven't commented it yet aswell) :

#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>

using namespace std;

class Passenger
{
	string **FirstArray;
	static const int firstClassRow = 2;
	static const int firstClassColumn = 2;

	string **BusArray;
	static const int busClassRow = 3;
	static const int busClassColumn = 4;

	string **EconArray;
	static const int econClassRow = 7;
	static const int econClassColumn = 6;

	static const char Available = '*';
	static const char Occupied  = '+';

public:
	Passenger()
	{
	FirstArray = new string*[firstClassRow];
	for (int i = 0; i < firstClassRow; i++)
		FirstArray[i] = new string[firstClassColumn];

	BusArray = new string*[busClassRow];
	for (int i = 0; i < busClassRow; i++)
		BusArray[i] = new string[busClassColumn];

	EconArray = new string*[econClassRow];
	for (int i = 0; i < econClassRow; i++)
		EconArray[i] = new string[econClassColumn];

	memset(FirstArray, Available, sizeof FirstArray);
	memset(BusArray, Available, sizeof BusArray);
	memset(EconArray, Available, sizeof EconArray);

	void addPassenger(int rowNumber, int columnNumber);
	string getSeat(int rowNumber, int columnNumber);
	};

	~Passenger() {
		for (int i = 0; i < firstClassRow; i++)
			delete [] FirstArray[i];
		delete [] FirstArray;

		for (int i = 0; i < busClassRow; i++)
			delete [] BusArray[i];
		delete [] BusArray;

		for (int i = 0; i < econClassRow; i++)
			delete [] EconArray[i];
		delete [] EconArray;
	}

	void Passenger::addPassenger(int rowNumber, int columnNumber) {
		if (rowNumber <= 2) {
			FirstArray[rowNumber][columnNumber]= "test";
		} else if (rowNumber > 2 && rowNumber <= 5) {
			BusArray[rowNumber][columnNumber]= "test";
		} else {
			EconArray[rowNumber][columnNumber]= "test";
		}
	}
	string Passenger::getSeat(int rowNumber, int columnNumber) {
		string seat;
		if (rowNumber <= 2) {
			seat = FirstArray[rowNumber][columnNumber];
		} else if (rowNumber > 2 && rowNumber <= 5) {
			seat = BusArray[rowNumber][columnNumber];
		} else {
			seat = EconArray[rowNumber][columnNumber];
		}
		return seat;
	}

	void showSeating() {
	}

	void changePassenger() {
	}

	void cancelPassenger() {
	}

	void showReport() {
	}
};

void displayMenu();
void reserveSeat();
char columnMaxCheck(int row);
char getColumnNumber(char maxColumn, int row);
int getRowNumber();

Passenger airline;

int main()
{
	const int Reserve = 1;
	const int Change = 2;
	const int Cancel = 3;
	const int Report = 4;
	const int Quit = 5;

	int menuSelection  =0;
	bool exitApplication = false;
	
	string input = "";

	while (!exitApplication) {
		displayMenu();
	while (true) {
		cin >> input;
		stringstream myStream(input);
		if (myStream >> menuSelection)
			break;
		cout << "\n *Invalid input, please try again!*"
			<< "\n\nPlease select an option (1-5): "<< endl;
	}
		static_cast<int>(menuSelection);
			switch (menuSelection) {
				case Reserve:
					reserveSeat();
					break;
				case Change:
					break;
				case Cancel:
					break;
				case Report:
					break;
				case Quit:
					cout << "\n * Thanks for using Prestige Flights seat allocation system *";
					exitApplication = true;
					cin.get();
					break;
				default:
					cout << " *Please input a valid menu option, type only 1, 2, 3, 4 or 5*\n";
					cin.get();
			}
	}
}

void displayMenu()
{
	cout << "---------------------------------------------------"
		<< "------------------"
		<< "\n\n\n\n"
		<< "\n  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
		<< "\n"
		<< "\n   Welcome to Prestige Flight Services"
		<< "\n    Please follow the instructions"
		<< "\n          for seat allocation"
		<< "\n"
		<< "\n  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
		<< "\n"
		<< "\n      Seat Allocation Menu"
		<< "\n     ======================="
		<< "\n        1. Reserve a Seat"
		<< "\n"
		<< "\n        2. Change a Seat"
		<< "\n"
		<< "\n        3. Cancel a Seat"
		<< "\n"
		<< "\n        4. Dispaly Seat Report"
		<< "\n"
		<< "\n        5. Exit"
		<< "\n\n\n"
		<< "\nPlease select an option (1-5): ";
}

void reserveSeat()
{
	int rowNumber;
	int columnNumber;
	char columnNumberChar;
	char columns;

	cout << "\n\n The airplane contains 12 rows.\n"
		<< " First Class - Rows 1 and 2\n"
		<< " Business Class - Rows 3 to 5\n"
		<< " Economy Class - Rows 6 to 12\n";
	rowNumber = getRowNumber();
	columns = columnMaxCheck(rowNumber);
	columnNumberChar = getColumnNumber(columns, rowNumber);

	if (columnNumberChar == 'A') {
		columnNumber = 0;
	} else if (columnNumberChar == 'B') {
		columnNumber = 1;
	} else if (columnNumberChar == 'C') {
		columnNumber = 2;
	} else if (columnNumberChar == 'D') {
		columnNumber = 3;
	} else if (columnNumberChar == 'E') {
		columnNumber = 4;
	} else {
		columnNumber = 5;
	}
	airline.addPassenger((rowNumber-1),columnNumber);
}

char columnMaxCheck(int row) {
	char columns;

	if (row <= 2) {
		columns = 'B';
	}
	else if (row > 2 && row <= 5) {
		columns = 'D';
	}
	else if (row > 5 && row <= 12) {
		columns = 'F';
	}
	return columns;
}

char getColumnNumber(char maxColumn, int row) {
	char columnNumber;

	cout << "\nPlease enter your desired seat number (A - " << maxColumn << "):" << endl;
	cin >> columnNumber;
	columnNumber = static_cast<char>(toupper(columnNumber));
	if (row <= 2) {
		while(columnNumber != 'A' && columnNumber != 'B')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	} else if (row > 2 && row <= 5) {
		while(columnNumber != 'A' && columnNumber != 'B' && columnNumber != 'C'
			&& columnNumber != 'D')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	} else if (row > 5 && row <= 12) {
		while(columnNumber != 'A' && columnNumber != 'B' && columnNumber != 'C'
			&& columnNumber != 'D' && columnNumber != 'E' && columnNumber != 'F')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	}
	return columnNumber;
}
	

int getRowNumber() {
	int rowNumber = 0;
	const int firstRow = 1;
	const int lastRow = 12;
	string input = "";
	
	bool notValidRowOption = true;

	while (notValidRowOption == true) {
		while (true) {
			cout << "\nPlease enter your desired row: " << endl;
			cin >> input;
			stringstream myStream(input);
			if (myStream >> rowNumber)
				break;
			cout << "\n * Invalid input, please enter a number! *" << endl;
		}
		if (rowNumber < firstRow || rowNumber > lastRow) {
			cout << "\n * Invalid input, number must be between 1-12! *\n";
		} else {
			notValidRowOption = false;
		}
	}
	return rowNumber;
}

Any help with this would be greatly appreciated.
Thanks so much guys!
Luke

I recommend running some tests to find out where the code is going wrong (some simple cout commands may suffice), then post the appropriate piece of code that is causing the problem. There are some here who may go through all those lines of code to find your error, but not many.

On top of that i would also post the expected output and what you are getting, as a clue to where the problem lies.

Holy crap, is it airline seating assignment season again? Oh, how time flies. :icon_rolleyes:

The problem is trying to memset an array of arrays of std::strings. I'd strongly suggest forgetting that memset exists in C++, because it's totally not worth the headache. Consider something more like this for your constructor, because right now you're corrupting the hell out of your memory:

Passenger()
{
    FirstArray = new string*[firstClassRow];
    for (int i = 0; i < firstClassRow; i++) {
        FirstArray[i] = new string[firstClassColumn];
            
        for (int j = 0; j < firstClassColumn; j++)
            FirstArray[i][j] = Available;
    }

    BusArray = new string*[busClassRow];
    for (int i = 0; i < busClassRow; i++) {
        BusArray[i] = new string[busClassColumn];
            
        for (int j = 0; j < busClassColumn; j++)
            BusArray[i][j] = Available;
    }

    EconArray = new string*[econClassRow];
    for (int i = 0; i < econClassRow; i++) {
        EconArray[i] = new string[econClassColumn];
            
        for (int j = 0; j < econClassColumn; j++)
            EconArray[i][j] = Available;
    }
}

Thanks for your help, from what i can tell it has something to do with how i've set up my array. I'm not sure i've set it up correctly. Because when testing with this code at the start of my main function:

cout << airline.getSeat(0,0);

it should return the value intially set as '*'. But instead comes up with an unhandled exception error especially relating to the string library. Also just saw the new reply. haha yeah i've found it seems there are alot of questions regarding airline seating assignments/homework. It must be lecturers favourite problem to use. I'll try that and see if that helps with the error. Thanks so much again.

It must be lecturers favourite problem to use

It's one of the problems given out at roughly the same time during a course and favored by many schools. So every year we'll see a slew of questions about airline seating for maybe a month. Another common one is round robin scheduling.

Problem I see is an over complex concept.

Why dynamic arrays? They are harder to deal with and your plane size is fixed. How about seating[12][4] to make it easy on yourself. Note your instructions say "The data structure that is used to store Passenger objects must be array." No mention of dynamic.

Also, the instructions state "You must define and implement a class Passenger to model passenger objects and you must use the class in your program." Your passenger class models the airplane object, not the passenger. A passenger does not have 12 rows. It also says the class object must be an array. It doesn't say the class must contain arrays.

Just food for thought...

Hey guys, i fiddled around with my code to try and make a non dynamic array and also the class object an array and now when i try to compile i get "error C2512: 'Passenger' : no appropriate default constructor available". I've always seemed to struggle with arrays but all your help has been great so far! I'm not quite sure if what i've done is correct but i'm also sure i have to add something more to the class. Any help would be much appreciated, my code is now:

#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>

using namespace std;

class Passenger
{
	string passangerName;
	
public:
	Passenger(string name)
	{
		passangerName = name;
	}

	void addPassenger(int rowNumber, int columnNumber) {
	}

	string getSeat(int rowNumber, int columnNumber) {
	}

	void showSeating() {
	}

	void changePassenger() {
	}

	void cancelPassenger() {
	}

	void showReport() {
	}
};

void displayMenu();
void reserveSeat();
char columnMaxCheck(int row);
char getColumnNumber(char maxColumn, int row);
int getRowNumber();

int main()
{
	const int Reserve = 1;
	const int Change = 2;
	const int Cancel = 3;
	const int Report = 4;
	const int Quit = 5;

	const int firstClassRow = 2;
	const int firstClassColumn = 2;

	const int busClassRow = 3;
	const int busClassColumn = 4;

	const int econClassRow = 7;
	const int econClassColumn = 6;

	const string Available = "*";
	const string Occupied  = "+";

	int menuSelection  =0;
	bool exitApplication = false;
	
	string input = "";

	Passenger FirstArray[firstClassRow][firstClassColumn];
	Passenger BusArray[busClassRow][busClassRow];
	Passenger EconArray[econClassRow][econClassColumn];

	for (int i=0; i < firstClassRow; i++) {
		for (int j = 0; j < firstClassColumn; j++)
			FirstArray[i][j] = Available;
	}

	for (int i=0; i < busClassRow; i++) {
		for (int j = 0; j < busClassColumn; j++)
			BusArray[i][j] = Available;
	}

	for (int i=0; i < econClassRow; i++) {
		for (int j = 0; j < econClassColumn; j++)
			EconArray[i][j] = Available;
	}


	while (!exitApplication) {
		displayMenu();
	while (true) {
		cin >> input;
		stringstream myStream(input);
		if (myStream >> menuSelection)
			break;
		cout << "\n *Invalid input, please try again!*"
			<< "\n\nPlease select an option (1-5): "<< endl;
	}
		static_cast<int>(menuSelection);
			switch (menuSelection) {
				case Reserve:
					reserveSeat();
					break;
				case Change:
					break;
				case Cancel:
					break;
				case Report:
					break;
				case Quit:
					cout << "\n * Thanks for using Prestige Flights seat allocation system *";
					exitApplication = true;
					cin.get();
					break;
				default:
					cout << " *Please input a valid menu option, type only 1, 2, 3, 4 or 5*\n";
					cin.get();
			}
	}
}

void displayMenu()
{
	cout << "---------------------------------------------------"
		<< "------------------"
		<< "\n\n\n\n"
		<< "\n  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
		<< "\n"
		<< "\n   Welcome to Prestige Flight Services"
		<< "\n    Please follow the instructions"
		<< "\n          for seat allocation"
		<< "\n"
		<< "\n  *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
		<< "\n"
		<< "\n      Seat Allocation Menu"
		<< "\n     ======================="
		<< "\n        1. Reserve a Seat"
		<< "\n"
		<< "\n        2. Change a Seat"
		<< "\n"
		<< "\n        3. Cancel a Seat"
		<< "\n"
		<< "\n        4. Dispaly Seat Report"
		<< "\n"
		<< "\n        5. Exit"
		<< "\n\n\n"
		<< "\nPlease select an option (1-5): ";
}

void reserveSeat()
{
	int rowNumber;
	int columnNumber;
	char columnNumberChar;
	char columns;

	cout << "\n\n The airplane contains 12 rows.\n"
		<< " First Class - Rows 1 and 2\n"
		<< " Business Class - Rows 3 to 5\n"
		<< " Economy Class - Rows 6 to 12\n";
	rowNumber = getRowNumber();
	columns = columnMaxCheck(rowNumber);
	columnNumberChar = getColumnNumber(columns, rowNumber);

	if (columnNumberChar == 'A') {
		columnNumber = 0;
	} else if (columnNumberChar == 'B') {
		columnNumber = 1;
	} else if (columnNumberChar == 'C') {
		columnNumber = 2;
	} else if (columnNumberChar == 'D') {
		columnNumber = 3;
	} else if (columnNumberChar == 'E') {
		columnNumber = 4;
	} else {
		columnNumber = 5;
	}
}

char columnMaxCheck(int row) {
	char columns;

	if (row <= 2) {
		columns = 'B';
	}
	else if (row > 2 && row <= 5) {
		columns = 'D';
	}
	else if (row > 5 && row <= 12) {
		columns = 'F';
	}
	return columns;
}

char getColumnNumber(char maxColumn, int row) {
	char columnNumber;

	cout << "\nPlease enter your desired seat number (A - " << maxColumn << "):" << endl;
	cin >> columnNumber;
	columnNumber = static_cast<char>(toupper(columnNumber));
	if (row <= 2) {
		while(columnNumber != 'A' && columnNumber != 'B')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	} else if (row > 2 && row <= 5) {
		while(columnNumber != 'A' && columnNumber != 'B' && columnNumber != 'C'
			&& columnNumber != 'D')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	} else if (row > 5 && row <= 12) {
		while(columnNumber != 'A' && columnNumber != 'B' && columnNumber != 'C'
			&& columnNumber != 'D' && columnNumber != 'E' && columnNumber != 'F')
		{
			cout << "\n * Invalid seat number, seat must be between (A - " << maxColumn << ") *";
			cout << "\n\nPlease enter your desired seat: " << endl;
			cin >> columnNumber;
			columnNumber = static_cast<char>(toupper(columnNumber));
		}
	}
	return columnNumber;
}
	

int getRowNumber() {
	int rowNumber = 0;
	const int firstRow = 1;
	const int lastRow = 12;
	string input = "";
	
	bool notValidRowOption = true;

	while (notValidRowOption == true) {
		while (true) {
			cout << "\nPlease enter your desired row: " << endl;
			cin >> input;
			stringstream myStream(input);
			if (myStream >> rowNumber)
				break;
			cout << "\n * Invalid input, please enter a number! *" << endl;
		}
		if (rowNumber < firstRow || rowNumber > lastRow) {
			cout << "\n * Invalid input, number must be between 1-12! *\n";
		} else {
			notValidRowOption = false;
		}
	}
	return rowNumber;
}

EDIT: just realised, so you guys don't have to read through all my code to see the changes the changes i made were to the class function which is now

class Passenger
{
	string passangerName;
	
public:
	Passenger(string name)
	{
		passangerName = name;
	}

	void addPassenger(int rowNumber, int columnNumber) {
	}

	string getSeat(int rowNumber, int columnNumber) {
	}

	void showSeating() {
	}

	void changePassenger() {
	}

	void cancelPassenger() {
	}

	void showReport() {
	}
};

and also to the start of my main function:

int main()
{
	const int Reserve = 1;
	const int Change = 2;
	const int Cancel = 3;
	const int Report = 4;
	const int Quit = 5;

	const int firstClassRow = 2;
	const int firstClassColumn = 2;

	const int busClassRow = 3;
	const int busClassColumn = 4;

	const int econClassRow = 7;
	const int econClassColumn = 6;

	const string Available = "*";
	const string Occupied  = "+";

	int menuSelection  =0;
	bool exitApplication = false;
	
	string input = "";

	Passenger FirstArray[firstClassRow][firstClassColumn];
	Passenger BusArray[busClassRow][busClassRow];
	Passenger EconArray[econClassRow][econClassColumn];

	for (int i=0; i < firstClassRow; i++) {
		for (int j = 0; j < firstClassColumn; j++)
			FirstArray[i][j] = Available;
	}

	for (int i=0; i < busClassRow; i++) {
		for (int j = 0; j < busClassColumn; j++)
			BusArray[i][j] = Available;
	}

	for (int i=0; i < econClassRow; i++) {
		for (int j = 0; j < econClassColumn; j++)
			EconArray[i][j] = Available;
	}


	while (!exitApplication) {
		displayMenu();
	while (true) {
		cin >> input;
		stringstream myStream(input);
		if (myStream >> menuSelection)
			break;
		cout << "\n *Invalid input, please try again!*"
			<< "\n\nPlease select an option (1-5): "<< endl;
	}
		static_cast<int>(menuSelection);
			switch (menuSelection) {
				case Reserve:
					reserveSeat();
					break;
				case Change:
					break;
				case Cancel:
					break;
				case Report:
					break;
				case Quit:
					cout << "\n * Thanks for using Prestige Flights seat allocation system *";
					exitApplication = true;
					cin.get();
					break;
				default:
					cout << " *Please input a valid menu option, type only 1, 2, 3, 4 or 5*\n";
					cin.get();
			}
	}
}

You could create a passenger class with just a string object, ie a name.

Then you could have a seat class which has several variable members including a passenger, a row number, a seat number and a char to keep track of whether the seat is occupied or not.

Lastly you could have a plane class which hs a 2 dimensional array of seats and an array of passengers. Member methods of this class can display a seating chart (ie the 2d array of seats mentioning just the occupied status) and a passenger list. It should also have methods to obtain a request for a seat and deterimine if the seat is occupied. If it is, notify the requestor to select a different seat. If it isn't get the passengers name and assign it to the appropriate seat and to the array of passengers. Other nice touches might be to display the passengers with their seating assignments, keep track of how many passengers are actually on board, etc.

Alternatively, the plane could be declared as an 2d array of seats within main() as could the array of passengers and all of the functions declared as methods in the plane class above could be declared as free standing functions.

And not to ignore them, you need to determine what access you feel comfortable using for the various class variables and, if you elect to use private, which would be the most desirable, then you need to add the appropriate public methods to access and mutate the member variable. In addition you have to decide if the default constructors and operators provided by the compiler are adequate or should you declare and define them explicitly.

Thanks for your help, i've been trying to work out on my code how to fix that error of "error C2512: 'Passenger' : no appropriate default constructor available". I'm not sure if i've declared the arrays correctly either in the class or in my main function? Any help would be much appreciated with that. I tried adding

class Passenger
{
	string passangerName;
	
public:
	Passenger() {
	string FirstArray[2][2];
	string BusArray[3][4];
	string EconArray[7][6];
	}
	Passenger(string name)
	{
		passangerName = name;
	}

	void addPassenger(int rowNumber, int columnNumber) {
	}

	string getSeat(int rowNumber, int columnNumber) {
	}

	void showSeating() {
	}

	void changePassenger() {
	}

	void cancelPassenger() {
	}

	void showReport() {
	}
};

to see if that would work but it gives me a debug assertion failed error when i try to run it.

Sorry for the double post guys, but i'm unable to edit my previous post. I made some changes to my code and it no longer comes up with that error about the default constructor. I just wanted to check i've declared my array correctly. Thanks again guys for all your help :).

Class code:

class Passenger
{
	string passangerName;
	static const int firstClassRow = 2;
	static const int firstClassColumn = 2;

	static const int busClassRow = 3;
	static const int busClassColumn = 4;

	static const int econClassRow = 7;
	static const int econClassColumn = 6;

	string FirstArray[firstClassRow][firstClassColumn];
	string BusArray[busClassRow][busClassRow];
	string EconArray[econClassRow][econClassColumn];

	
public:
	Passenger() {
	string Available = "*";
	for (int i=0; i < firstClassRow; i++) {
		for (int j = 0; j < firstClassColumn; j++)
			FirstArray[i][j] = Available;
	}

	for (int i=0; i < busClassRow; i++) {
		for (int j = 0; j < busClassColumn; j++)
			BusArray[i][j] = Available;
	}

	for (int i=0; i < econClassRow; i++) {
		for (int j = 0; j < econClassColumn; j++)
			EconArray[i][j] = Available;
	}
	}
	Passenger(string name)
	{
		passangerName = name;
	}

	void addPassenger(int rowNumber, int columnNumber) {
	}

	string getSeat(int rowNumber, int columnNumber) {
	}

	void showSeating() {
	}

	void changePassenger() {
	}

	void cancelPassenger() {
	}

	void showReport() {
	}
};

Main code:

void displayMenu();
void reserveSeat();
char columnMaxCheck(int row);
char getColumnNumber(char maxColumn, int row);
int getRowNumber();

int main()
{
	const int Reserve = 1;
	const int Change = 2;
	const int Cancel = 3;
	const int Report = 4;
	const int Quit = 5;

	const int firstClassRow = 2;
	const int firstClassColumn = 2;

	const int busClassRow = 3;
	const int busClassColumn = 4;

	const int econClassRow = 7;
	const int econClassColumn = 6;

	const string Available = "*";
	const string Occupied  = "+";

	int menuSelection  =0;
	bool exitApplication = false;
	
	string input = "";

	Passenger FirstArray[firstClassRow][firstClassColumn];
	Passenger BusArray[busClassRow][busClassRow];
	Passenger EconArray[econClassRow][econClassColumn];


	while (!exitApplication) {
		displayMenu();
	while (true) {
		cin >> input;
		stringstream myStream(input);
		if (myStream >> menuSelection)
			break;
		cout << "\n *Invalid input, please try again!*"
			<< "\n\nPlease select an option (1-5): "<< endl;
	}
		static_cast<int>(menuSelection);
			switch (menuSelection) {
				case Reserve:
					reserveSeat();
					break;
				case Change:
					break;
				case Cancel:
					break;
				case Report:
					break;
				case Quit:
					cout << "\n * Thanks for using Prestige Flights seat allocation system *";
					exitApplication = true;
					cin.get();
					break;
				default:
					cout << " *Please input a valid menu option, type only 1, 2, 3, 4 or 5*\n";
					cin.get();
			}
	}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.