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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
#include <iostream>
#include <cctype>
#include <iomanip>
#include <fstream>
#include <cstring>
#include <cstdlib>
using namespace std;
//Declare function proto type
char menu;
char answer, seats;
int price1, price2, price3, runningTotal;
const int COLS = 8;
const int ROWS = 16;
void showArray(const int[][COLS], int);
int main()
{
int table1[ROWS][COLS] = {{'0', '1', '2', '3', '4', '5', '6'},
{'1', '0', '0', '0', '0', '0', '0'},
{'2', '0', '0', '0', '0', '0', '0'},
{'3', '0', '0', '0', '0', '0', '0'},
{'4', '0', '0', '0', '0', '0', '0'},
{'5', '0', '0', '0', '0', '0', '0'},
{'6', '0', '0', '0', '0', '0', '0'},
{'7', '0', '0', '0', '0', '0', '0'},
{'8', '0', '0', '0', '0', '0', '0'},
{'9', '0', '0', '0', '0', '0', '0'},
{'10', '0', '0', '0', '0', '0', '0'},
{'11', '0', '0', '0', '0', '0', '0'},
{'12', '0', '0', '0', '0', '0', '0'},
{'13', '0', '0', '0', '0', '0', '0'},
{'14', '0', '0', '0', '0', '0', '0'},
{'15', '0', '0', '0', '0', '0', '0'}};
ifstream infile;
int price1, price2, price3;
infile.open("SeatPrices.txt");
infile >> price1;
infile >> price2;
infile >> price3;
infile.close();
return 0;
}
do
{
void showArray(table1, ROWS);
cout << endl << "Menu" << endl << "(1)Reservation:" << endl << "(2)Display: " << endl << "(3)Quit: " << endl;
cin >> answer;
while (answer < 1 || answer > 3)
{
cout << "Invalid Choice, Please Select Again. ";
cin >> answer;
}
if(answer == 1)
{
cout << "Welcome to reservations" << endl << "Seats marked with # are available" << endl << "Seats marked with a * are taken " << endl;
void showArray(table1[][COLS], int rows)
{
for (int x = 1; x < rows; x++)
{
for (int y = 1; y < cols; y++)
{
cout << setw(7) << array[x][y] << " ";
}
}
}
void available(table1[][COLS])
{
for (int i = 0; i < ROWS; i++)
for (int j = 0; j < COLS; j++)
seats[i][j];
}
char choose (int table1[][COLS])
{
int row, column, col;
double firstClass = price1, firstFiveCoach = price2, lastFive = pric3;
cout << endl << "enter Row 1-15: ";
cin >> row;
cout << endl << "Enter Seat 1-6: ";
cin >> col;
col = toupper(col);
column = col
if(row < 1 && row > 15 && col < && row >1, row<6, col 1 > 5, col < 1)
{
cout << endl << "Invalid row!! " << endl;
row--;
}
if (row >=1 && row <= 5)
{
cout << endl << "Your first class ticket cost: " << price1 << endl;
price1 += runningTotal;
}
if (row >=6 && row <= 10)
{
cout << endl << "Your Coach class ticket cost: " << price2 << endl;
price2 += runningTotal;
}
if (row >=11 && row <= 15)
{
cout << endl << "Your Coach class ticket cost: " << price3 << endl;
price3 += runningTotal;
}
if (seats[row][column] == '*');
cout << endl << "this seat has been taken." << endl;
seats[row][column] = '*';
return seats['*'][COLS];
}
if(answer == 2)
void showArray(table1[][COLS], int rows)
{
for (int x = 1; x < rows; x++)
{
for (int y = 1; y < cols; y++)
{
cout << setw(7) << array[x][y] << " ";
cout >> endl >> "The Total cost of the seats is: " >> runningTotal >> endl;
}
}
}
if(answer == 3)
return 0;
}
}
|