Theater Seating Chart

I've been working on this theater seating chart here that can also sell tickets, but i'm at a bit of a loss in regards to the chart. I can't seem to figure out exactly what to do when passing the ticket purchases to the chart function. It always seems to show a '#' for each seat, which means it is open. I also haven't started on the function that will tell you how many seats are in each row. Everything else seems to work though. Its also very messy, so I apologize in advance for that. Thanks for the help!

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
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;

const int ROW = 15, COLUMN = 30;

const char TAKEN = '*', OPEN = '#';

void fillArray(double prices[ROW]);

void displayTotalValue(int& total);

void displayTotalTickets(int& seatAud, int seatTotal);

void displaySeatsRow();

void displaySeatsAuditorium(int& seatAud);

void displayChart(char map[ROW][COLUMN], int row2, int column2);

int main()
{
	int row2, column2, cost;
	int seat2 = 0;
	int choice2 = 1;
	int total = 0, seatAud = ROW * COLUMN, seatTotal = ROW * COLUMN;
	char choice, map[ROW][COLUMN];
	double prices[ROW];
	fillArray(prices);
	cout << "Welcome to the theater! What would you like to do?" << endl;
	do
	{
		cout << "\n1. Purchase Tickets\n2. Display the total dollar value of all tickets sold" << endl;
		cout <<	"3. Display the total number of tickets sold\n4. Display the number of seats available in each row\n5. Display the number of seats available in the entire auditorium" << endl;
		cout << "6. Display the current seating chart\n7. Exit the system" << endl;
		cin >> choice;

		switch(choice)
		{
			case '1':
				{
				do
				{
					cout << "Please select the row you would like to sit in: ";
					cin >> row2;
					cout << "Please select the column you would like to sit in: ";
					cin >> column2;

					if (map[row2][column2] == TAKEN)
						cout << "Sorry that seat is sold-out, Please select a new seat." << endl;
			
							else
							{
								cost = prices[row2];
								total = total + cost;
								cout << "That ticket costs $" << cost << endl << "Your ticket has been processed." << endl;
								seatAud = seatAud - 1;
								seat2++;

								cout << "Would you like to look at another seat?(1 = YES / 2 = NO)";
								cin >> choice2;
							}
					}
					while (choice2 == 1);
				}
				break;
			case '2':
				displayTotalValue(total);
				break;
			case '3':
				displayTotalTickets(seatAud, seatTotal);
				break;
			case '4':
				displaySeatsRow();
				break;
			case '5':
				displaySeatsAuditorium(seatAud);
				break;
			case '6':
				displayChart(map, row2, column2);
				break;
			case '7':
				cout << "Goodbye!" << endl;
				break;
		default:
			cout << "Invalid Option" << endl;
		}
	}
	while(choice != '7');
}

void fillArray(double prices[])
{
	ifstream fin;
	fin.open("seats.txt");
	if(fin.fail())
		exit(1);
	for(int i = 0; i < 15; i++)
		fin >> prices[i];
}

void displayTotalValue(int& total)
{
	cout << "There have been $" << total << " in ticket sales." << endl;
}

void displayTotalTickets(int& seatAud, int seatTotal)
{
	cout << (seatTotal - seatAud) << " tickets have been sold." << endl;
}

void displaySeatsRow()
{
	char choice;
	cout << "Which row would you like to look at? ";
	cin >> choice;
	while(choice < 1 || choice < ROW)
	{
		cout << "Error. Try Again" << endl;
		cin >> choice;
	}
	
}

void displaySeatsAuditorium(int& seatAud)
{
	cout << "There are " << seatAud << " seats left in the Auditorium." << endl;
}

void displayChart(char map[ROW][COLUMN], int row2, int column2)
{
	cout << setw(30) << "         A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d\n";

	for(int j = 0; j < 15; j++)
	{
		cout << "        ";
		for(int i = 0; i < 30; i++)
		{
			cout << "+-";
		}
		cout << "+" << endl;
		cout << "Row " << (j + 1) << "\t";
		for(int m = 0; m < 30; m++)
		{
			cout << "|";
			if(map[j][m] == TAKEN)
				cout << TAKEN;
			else
				cout << OPEN;
		}
		cout << "|" << endl;
	}
	cout << "        ";
	for(int i = 0; i < 30; i++)
	{
		cout << "+-";
	}
	cout << "+" << endl;
	
}
Topic archived. No new replies allowed.