Theater seating chart help!

Hey, im having problems making a seating chart for a movie theater.

basically i have to get input of what row they would like to sit in and what chair in that row they would like to sit in but im totally stumped.

output should be something like this:
* = not taken
# = taken

* * * * * * * * # # # *
# # # # # * * * * # # *
* * * # # # # # # # # #
* # # # # # # # # # # #

and so on

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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;

//~Functions:
//---------------------------------------------------------------------------------------------------------------------//

//~Function: Main menu
//~Sub functions: Main menu
void enterMainMenu(ifstream& fIn, ifstream& FfIn);
void exit();

//~Function: Misc.
int goAgain(int choice);

//~Main function
//---------------------------------------------------------------------------------------------------------------------//

int main()
{
	ifstream fin;
	ifstream Ffin;
	Ffin.open("seats.txt");
	fin.open("rowPrice.txt");
	if (fin.fail() || Ffin.fail())
	{
		cout << "Failed to open" << endl;
		exit(1);
	}
	enterMainMenu(fin, Ffin);
}

//~Function Definition:
//---------------------------------------------------------------------------------------------------------------------//

//~Menu:
//
void enterMainMenu(ifstream& fIn, ifstream& FfIn)
{
	int choice;
	int tickets = 0, temp = 0;
	double seating[15][30];
	int row = -1, seat = -1;
	double money = 0;

	do
	{
		cout << "\nWelcome to the Benidum Theater:    " << endl;
		cout << "---------------------------------------------" << endl;
		cout << "1 - Buy tickets" << endl; //done
		cout << "2 - Tickets sold" << endl; //done
		cout << "3 - Seating chart" << endl;
		cout << "4 - Money gained" << endl; //done
		cout << "5 - Seats avalible in theater" << endl;
		cout << "6 - Seats avalible in a row" << endl;
		cout << "7 - exit" << endl; //done
		cout << "---------------------------------------------" << endl;
		cout << " " << endl;
		cout << "Pick a sub menu please. \nPlease choose your destination 1-7." << endl;
		cout << " " << endl;
		cout << "Choose destination: ";

		cin >> choice;
		goAgain(choice);
		system("cls");

		if (choice == 1)	//buy tickets
		{
			cout.setf(ios::fixed);
			cout.precision(2);

			int counter = 0;
			double pricing[15] = {5.00, 5.50, 6.00, 6.50, 7.00, 7.00, 7.50, 8.00, 7.50, 7.00, 6.50, 6.00, 5.50, 5.00, 4.50};
				
				system("cls");
				cout << "Prices:" << endl;
				cout << "Note: There are 30 seats per row:" << endl;
				cout << "---------------------------------------------" << endl;
			
					for (int i = 0; i < 15; i++)
					{
						cout << "Row " << i << ":\t" << setw(10) << "$" << pricing[i] << endl;
					}
			
				cout << "---------------------------------------------" << endl;
				cout << "What row do you want to sit in: ";
				cin >> row;

					if (row < 0 || row > 15)
					{
						system("cls");
						cout << "Sorry! That row doesn't exist." << endl;
						cout << "Exiting to main menu:" << endl;
						system("pause");
						system("cls");
					}
					else
					{
						system("cls");
						cout << "Seats:" << endl;
						cout << "Choose a seat between 1 - 30:" << endl;
						cout << "---------------------------------------------" << endl;
						cout << "What seat in row " << row << " would you like to sit in: ";
						cin >> seat;
					}


					if (seat < 0 || seat > 30)
					{
						system("cls");
						cout << "Sorry! That seat doesn't exist." << endl;
						cout << "Exiting to main menu:" << endl;
						system("pause");
						system("cls");
					}
					else
					{
						cout << endl;
						cout << "You are now sitting in row #" << row << " in seat #" << seat << endl;
						tickets++;
						temp += tickets;
						system("pause");
						system("cls");
					}

		}
		
		if (choice == 2)
		{
			system("cls");
			cout << "Ticket Booth: " << endl;
			cout << "---------------------------------------------" << endl;
			cout << "#Tickets Sold: " << tickets << endl;
			cout << " " << endl;
			system("pause");
			system("cls");
		}
		
[output][/output]
		if (choice == 3) //having problems from heret too....
		{
			seating[row][seat];
			for (int y = 0; y < 15; y++)
			{
				for (int x = 0; x < seat; x++)
				{
					if (seating[y][x] = seat)
						cout << "#";
					else
						cout << "*";
				}
				cout << endl;
			}
		} //here
		
		if (choice == 4)
		{
			double getRowPrice[15];
			getRowPrice[row];

			if (row == -1)
			{
				cout.setf(ios::fixed);
				cout.precision(2);
				money += 0.00;
				row = -1;
				cout << "Money Gained:" << endl;
				cout << "--------------------------" << endl;
				cout << "$" << money << endl;
				cout << endl;
				system("pause");
				system("cls");
			}

			for (int i = 0; i < 15; i++)
			{
				fIn >> getRowPrice[i];
				if (i == row)
				{
					cout.setf(ios::fixed);
					cout.precision(2);
					money += getRowPrice[i];
					cout << "Money Gained:" << endl;
					cout << "--------------------------" << endl;
					cout << "$" << money << endl;
					row = -1;
					cout << endl;
					system("pause");
					system("cls");
				}
			}
		}
		
		if (choice == 5)
		{

		}
		
		if (choice == 6)
		{
			int temp = 30, counter = 0;
		
		}
		
		if (choice == 7)
			exit();

		if (choice > 8)
		{
			cout << "Improper Input:" << endl;
			cout << " " << endl;
			cout << "Destination does not exist or doesn't match user input!" << endl;
			cout << " " << endl;
			system("pause");
			system("cls");
		}

	}
	while (choice > 0);
}

void exit()
{
	exit(1);
}

//~Misc:

int goAgain(int choice)
{
	int a = 0;
	do
	{
		a = 0;

		if (choice > 0)
			return choice;
		if (choice < 0)
			return choice;
		if (choice <= -1)
		{
			cout << "Thanks for buying our tickets :)!" << endl;
			system("pause");
			exit(0);
		}
	} 
	while (a == 1);
}
i didnt read all your program, but for instance- why didnt you do it with 'switch'?
cause im better with if
Topic archived. No new replies allowed.