Hi,
while waiting for help, I help myself a bit (LOL that sounds so akward). ANYWAY.
Instead of the original code, which is to ask for the price of 12 rows:
//initialize seat prices for each of the 12 rows
for (int i = 0; i < 12; i++)
{
cout << "\nPlease enter ticket price for Row " << i + 1 << ": ";
cin >> ticketPrice [i];
}
I changed it to this:
void main ()
{
int choice;
char response = 'Y';
float seatprices[4] = { 4.0, 5.0, 6.0, 7.0 }; //just some defaults here: ASWL
char seattypes[4][12] = { "Aisle", "Regular", "Window", "Leg Room" }; //this makes it possible to do input with a loop
cout << "WELCOME TO C++ AIRPLANES SEATING ALLOCATION SYSTEM!\n";
cout << "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n";
//initialize airplane with labels (A, S, W, L) - all seats available
for (int y =0; y < 1; y++)
for (int q = 0; q <4; q++)
airplane [y][q] = 'L'; //Leg Room Seats
for (y = 1; y < 12; y++)
{
for (int z = 0; z < 4; z++)
{
for (int x = 0; x < 1; x++)
airplane [y][x] = 'S'; //Regular Seats
for (int v = 1; v < 3; v++)
airplane [y][v] = 'A'; //Aisle Seats
for (int w = 3; w <4; w++)
airplane [y][w] = 'W'; //Window Seats
}
}
//seatypes inputs
for (int i = 0; i < 4; i++)
{
cout << "Please enter price for " << seattypes[i] << " seats: ";
cin >> seatprices[i];
cout << endl;
}
and now I have to find a new way to display this in the DisplayPrices () function, and I don't think I did it right.
void DisplayPrices(float seatprices[], float seattypes[])
{
cout.precision(2);
cout.setf(ios::fixed | ios::right);
cout << "\n\tTicket Prices By Seat Types: " << endl << endl;
cout << "\tSeat Types Price" << endl;
cout << "\t------ -------" << endl << endl;
for (int m = 0; m < 4; m++)
seattypes[m];
for (int n = 0; n < 4; n++)
seatprices[n];
char keyin;
cout << endl << endl;
cout << "\nPress an alphanumeric key to continue.";
cin >> keyin;
}
can you tell me what I did wrong in the code above?
Karen