1 2
|
if (my_array[seatNum] == 0)
//If they enter 0
|
You've written `if the array holds a 0 in the entered position'
It should be
if( seatNum == 0 )
according to your comment
con(cont); // <---- Main error I am having. This is suppose to go down below to the void con(int cont)
there is no `void con(int cont)'
there is `void cont(int)' and `void con(string)' Using meaningful names would make it less confusing.
If you want to call `void cont(int)' you may do it as `cont(42)' (your function is not making use of the argument, more on that later).
1 2 3 4 5 6
|
//If the seat you choose is equal to 0 (not taken), the seat from the cin is real, and its smaller or = to 15,
// the stuff below it will print. I know thats a lot, but I think this works.
if(my_array[seatNum] == 0 && seatNum !=0 && seatNum <=15)
{
cout << "Seat " << seatNum << " has been reserved." << endl;
}
|
You are risking out of bounds there. First verify that the seat is valid, then check if it is taken
Maybe a misuse of the language on my part, but I understand the message as `you can't take that seat because someone else already reserve it'.
1 2 3 4 5 6 7
|
void con(int cont)
{
cout << "\nContinue y/n ?";
cin >> cont;
//cont is a void, should it be a string?
if(cont == "y")
|
It doesn't matter how do you call that function, because the first thing you do is to discard the argument. Note that `cont(42)' `cont(-1)' `cont(0)' would all be equivalent.
Then it seems that you want to read a character, but you asked for an integer ¿?
Also, ¿how is that function supposed to interact? it doesn't care about its parameters and doesn't return anything.
1 2 3 4 5
|
bool keep_going(){
char answer;
std::cin>>answer;
return answer=='y';
}
|
1 2
|
cout << string (30, '\n') << endl; // <-- If you continue, it will "clear" the screen and go back to choosing MORE seats
function(seatNum);
|
¿what is `function()' ?
Line 71 `return' ¿what is that doing there?