1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
//Purpose: Displays a ticket pricing 2D array
#include <iostream>
#include <iomanip>
using namespace std;
const int row = 9;
const int col = 10;
//function displays the current seating chart
void seat_display(int seats[][col])
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
cout<< setw(7) << seats[i][j];
}
cout<< endl;
cout<< endl;
}
}
//function allows user to pick a seat number, enter a price, or quit the program
int select_seat()
{
int select;
cout << "Press 1 to enter seat number, 2 to enter a price, or 3 to quit: ";
cin >> select;
return select;
}
int main()
int seats[row][col] =
{
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{20, 20, 30, 30, 40, 40, 30, 30, 20, 20},
{20, 30, 30, 40, 50, 50, 40, 30, 30, 20},
{30, 40, 50, 50, 50, 50, 50, 50, 40, 30}
};
{
seat_display();
select = select_seat();
do
{
if (select == 1)//user enters a seat number
{
}
else //select is 2 because it is not 1 or 3, user enters a price
{
}
} while (select !=3)
}
}
|