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 70 71
|
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <windows.h>
using namespace std;
void use_array();
void display(int seatingArray[9][8]);
void seat_available(int seatingArray[9][8]);
int main()
{
int seatingArray[9][8] ={
{ 40, 50, 50, 50, 50, 50, 50, 40 },
{ 30, 30, 40, 50, 50, 40, 30, 30 },
{ 20, 30, 30, 40, 40, 30, 30, 20 },
{ 10, 20, 20, 20, 20, 20, 20, 10 },
{ 10, 20, 20, 20, 20, 20, 20, 10 },
{ 10, 20, 20, 20, 20, 20, 20, 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 } };
display(seatingArray);
seat_available(seatingArray);
}
void use_array()
{
}
void display(int seatingArray[9][8])
{
cout << setw(55) << "Available Theater Seating\n\n";
for(int i=8;i > 0; i--)
{
cout << "\n";
for(int q = 7; q > 0; q--)
{
cout << setw(8) << "$ " << seatingArray[i][q];
}
}
cout << endl;
}
void seat_available(int seatingArray[9][8])
{
int row, column;
char X;
for(int i = 72;i > 0; i--)
{
cout << "\n Please select a Theater Seat Row:" << "\n";
cin >> row;
cout << "Please select Theater Seat Column" << "\n";
cin >> column;
cout << "Thank you for choosing seat # " << row << ":" << column << "\n";
cout << "Your ticket price is :$" << seatingArray[row][column] << "\n";
if(seatingArray[row][column] == X)
{
cout << "ATTENTION: THE SEAT SELECTED, Row " << row << ", Column " << column << " DOES NOT EXIST.";
}
seatingArray[row][column] = X;
Sleep(1500);
system("CLS");
display(seatingArray);
}
}
|