Here is the gist of the assignment:
+ Ask user to enter seat prices for each row. The prices
can be stored in a separate array or read from an alt. file.
+ Then, display a seating chart. User may enter the row and
seat numbers for tickets being sold. Everytime a ticket or
group of tickets is purchased, display the total ticket
prices and update the seating chart.
+ Keep a total of all ticket sales. User should be given an
option of viewing this amount. (do-while loop?)
+ Also give the user an option to:
*see a list of how many seats have been sold
*how many seats are available in each row
*and how many seats are available in the entire
auditorium.
NO accepting of row or seat numbers that do not exist.
Make sure a particular seat is available before it is sold.
Here is my code SO FAR:
// Theater_Seating.cpp : Defines the entry point for the console application.
// This program brelongs to Nichole Moore.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
const int ROWS = 15;
const int SEATS = 30;
char chart[ROWS][SEATS] = {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*'};
int price[ROWS]; // Array for prices per row.
int r, c;
// Aske user for for prices per row.
for (r = 0; r < ROWS; r++)
{
cout << "Enter price for row " << (r+1) << ": $";
cin >> price[ROWS];
}
// Then display a seating chart where user can enter the row and
// seat numbers
// for tickets being sold.
// While doing this, display the total ticket prices and
// update&display the seating
// chart.
// Display seating chart - first time around (all seats available)
cout << "0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9\n";
for (r = 0; r < ROWS; r++)
{
for (c = 0; c < SEATS; c++)
{
cout << chart[r][c];
}
cout << endl;
}
return 0;
}
I am having a really hard time trying to start this out. I need some advice. My first question is - is there any way to initialize my chart array to something more simple/useful? My second question is pretty much the same for how I am displaying my chart. I would like to use functions if it makes it any easier, but if anyone here is going to assist me, please leave out using pointers because we have not learned how to pass arrays through functions yet!
Any help is very, very much appreciated! I am losing my mind with this thing, already... (I already started it over once or twice)
P.S.! The program I have displayed above displays the chart, but I don't know if I am going to have trouble with it later on (in order to meet the requirements of the assignment) AND right after the chart is displayed, the program errors and forces me to Abort. And I am obviously not done writing out the code yet, I have only yet just begun... I would also like to be able to display the row number next to the row.
Again, any help is appreciated!
This post has been edited by 4N63L-Z3R0: 11 December 2012 - 10:14 AM

New Topic/Question
Reply



MultiQuote



|