Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help fixing my code, I am trying to use pointers to access arrays. The program is making reservations to a theater with 3

I need help fixing my code, I am trying to use pointers to access arrays. The program is making reservations to a theater with 3 different sections. Each section has 10 rows and 20 columns. You can view mapping of the seats, reserve a seat if it's not taken, and remove the seat if you don't want it reserved anymore. Also when you reserve, you have to store the name of the person reserving it. image text in transcribed

#include #include #include using namespace std; //display map. initialize to nullptrs //reserve //list reserved seats //quit

//Error check section + row; int ROWS = 10; int COLS = 20; int displaySeat(char seatingChart[][20], int rows); int chooseSeat (char* seatingChart[][20], int rows, int& chosenRow, int& chosenCol); int alreadyTaken (char* seatingChart[][20],int rows); void showMenu(); int giveUpSeat (char* seatingChart[][20],int rows); int errorMessage ();

int main() { int option; cin >> option; showMenu(); cout > sectionLetter; if (sectionLetter = 'a') {chooseSeat(§ionA); }else if(sectionLetter = 'b') {chooseSeat(§ionB); }else if(sectionLetter = 'c') {chooseSeat(§ionC); }else {errorMessage();} } else if (option == 3){ cout

} }

/* Reserving a seat, type in Section, Row, and column. If row && seat && section choice is taken, cout it is taken conditions : seating is = nullptr || = available; else it is taken. */ int chooseSeat (char* seatingChart[][20], int rows, int& chosenRow, int& chosenCol){

for (int i=0; i> chosenRow; //col # cout > choseCol; cout

void showMenu (){ cout

int errorMessage (){ if (option != 1 && option != 2 && option != 3 && option != 4 && sectionLetter!='a' && sectionLetter!='b' && sectionLetter !='c'){ cout

error: #error This file requires compiler and library support for the ISO C warning: In function 'int main)': 75 identifier 'nullptr' is a keyword in C++11 -Wc++0x-compat] 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error expected primary-expression beforetoken 36 warning: suggest parentheses around assignment used as truth value -Rparen.. . 36 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 37 warning: suggest parentheses around assignment used as truth value -Rparen.. . 37 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 38 warning: suggest parentheses around assignment used as truth value -Rparen.. . 38 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 42error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 43error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 44error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... In function 'int displaySeat (char (*) [20])': 54 error: uninitialized const 'seats' [-fpermissive] 58 71 error a function-definition is not allowed here before ' token 54 warning: unused variable 'seats' [-unused-variable] 129 error expected'' at end of input 129 warning: no return statement in function returning non-void [-Wreturn-type errorrows' was not declared in this scope error: #error This file requires compiler and library support for the ISO C warning: In function 'int main)': 75 identifier 'nullptr' is a keyword in C++11 -Wc++0x-compat] 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error: cannot convert 'char () [10] [20]'to 'char () [20' for argument '1'.. . 31 error expected primary-expression beforetoken 36 warning: suggest parentheses around assignment used as truth value -Rparen.. . 36 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 37 warning: suggest parentheses around assignment used as truth value -Rparen.. . 37 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 38 warning: suggest parentheses around assignment used as truth value -Rparen.. . 38 error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 42error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 43error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... 44error: cannot convert 'char () [10] [20]'to 'char () [20]' for argument '1... In function 'int displaySeat (char (*) [20])': 54 error: uninitialized const 'seats' [-fpermissive] 58 71 error a function-definition is not allowed here before ' token 54 warning: unused variable 'seats' [-unused-variable] 129 error expected'' at end of input 129 warning: no return statement in function returning non-void [-Wreturn-type errorrows' was not declared in this scope

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago