I need help passing the "seat array" into the buyticket function. I have made the seating chart but i cant get the '#' to change into '*' when purchased. The seat array should all have the value of the char '#' but it doesnt seem to pass into the buyticket like that. It will always display "sorry this ticket has already been sold" when i try to buy a ticket.
#include<iostream>
#include<iomanip>
using namespace std;
// seat chart row and cols total
int const ROW= 15;
int const COLS= 30;
// main menu var
char choice=' ';
// user values row and col
int row;
int col;
// grand total ticket for ALL the customers
double totaltix=0.0;
// total ticket for ONE customer
double totaltixcust=0.0;
int totalclients=0;
int i;
int const Num_Rows=15;
// array seating
char seat[ROW][COLS];
// ticket price
double price [Num_Rows];
int x;
// available seat - seat taken
// get prices for the 15 rows feeding the price array
const int Num_Rows=15;
for (int i = 0; i < Num_Rows; i++)
{
cout<< "Please enter the price for row "<<setw(2)<<i+1<<": ";
cout<<fixed<<showpoint<<setprecision(2);
cin >> price [i];
// show the seat chart and call the function to buy the tickets
// var used to see or not the seat chart before buy the ticket
char choice=' ';
// var for the while
// char otherSeat='y';
cout << "\n\t\t C++ Theatre" << endl;
cout << "\t\tTicket Purchase Opportunity" << endl << endl;
cout << "Do you wish to view the chart of available seats \n"
<< "before making your selections (y/n)? ";
cin>>choice;
if(choice== 'y' || choice== 'Y')
{
// show the seat chart if the user want it calling the fuction showChart()
showChart(seat);
}
else (choice== 'n' || choice== 'N');
{
// call the function buyticket()
//IF YOU DIDNT CALL THE FUCTION SHOWCHART () THE IF/ELSE CONDITION IN BUYTICKET() IS NOT WORKING
//BECAUSE THE SEAT[][] ARRAY IS EMPTY .SO IT ALWAY EXECUTE THE ELSE . THEN THE SHOWCHART()
//NEED TO BE MODIFY FROM # TO * FOR AN SPECIF ROW AND COL INSIDE BUYTICKET()
buyticket(seat);
}
}
//**************************************
void buyticket (char seat [ROW][COLS])
{
// fuction to buy as many tickets as the user want
// var for the while
char otherSeat='y';
while (otherSeat== 'Y' || otherSeat== 'y')
{
cout << "\nPlease enter desired row number (1-" << ROW << "): ";
cin>>row;
// row must be <=15
while(row<1 || row>15)
{
cout << "Row must be between 1 and " << ROW << ". Please re-enter: ";
cin>>row;
}
cout << "\nPlease enter desired seat number (1-" << COLS << "): ";
cin>>col;
// cols must be <=30
while(col<1 || col>30)
{
cout << "Seat must be between 1 and " << COLS << ". Please re-enter: ";
cin>>col;
}
// check to see of seat is available ="#"
if(seat[row][col]== avaliableseat )
{
// if the seat is available
cout << "\nPurchase confirmed\n";
// mark the seat is taken
//UPDATE SHOWCHART FUNCTION IN ORDER TODISPLAY THE * SYMBOL IN THE CHART
seat[row][col]= takenseat;
}
else (seat[row][col]== takenseat);
{
// seat is taken . the user cant buy that ticket
cout << "\nSorry. That seat has been sold.\n";
}
// total clients
totalclients=totalclients++;
//total one user
totaltixcust=price[row-1];
//accumulate grand total price
totaltix=totaltix+totaltixcust;
cout << "\nWould you like to purchase another seat (y/n)? ";
cin >>otherSeat;
}
cout << "\n\nYou have purchased a total of " << totalclients << " tickets " << "for a total price of $" << totaltix;
}
void main_Menu()
{
int choice= 0;
while(choice!= 5)
{