Hello bubbagin,
FYI the beginning of the program four of your prototypes do not have matching function definitions. Not a problem until later in the program in your if statements you call those missing functions and get a compile error. You can either define an empty function for now or put a comment on the function calls that do not have a function definition yet.
The use of "goto"s is bad form and should be avoided. a "do while " loop will do the same thing. An example:
1 2 3 4 5 6
|
bool cont{true}; // <--- Initialized to true. Changed when exit is chosen.
do
{
// code here
} while (cont);
|
Do a search on "goto" or maybe "why is goto bad". There are many posts here about "goto"s.
Your "if" statements work, but a "switch" would be a better choice.
http://www.cplusplus.com/doc/tutorial/control/#switch
Now the big problem is in the "reserveSeat" function.
You start with
char seat
when it needs to be
int seat{ 0 };
. Later on line 156 when you access the array the subscripts are "int" and "char" and that is why it is not working. After changing "seat" to an int you could do this:
1 2 3 4 5 6 7
|
cin >> choice;
choice[1] = toupper(choice[1]); // <---Makes sure that the second element of string is an upper case letter
row = choice[0] - 48; // don't know why, but its 48 more than it should be
seat = choice[1] - 'A';
|
Since the input is a string each element of the string is a "char", so to get to a usable decimal "int" you subtract 48 or '0' and 65 or 'A'. Then on line 156 when you access the array you have the correct subscripts for the array, both "int"s. Next problem is the row number. You need to subtract 1 to access the correct row i.e., the first dimension. Other wise if the row is 10 this will be outside of your array bounds and the output will undetermined.
I think all that might be needed is to write the new array to the "chart.txt" file if you want to save the changes.
Hope that helps,
Andy