Restaurant C++ Help

thanks
Last edited on
1
2
3
4
5
6
7
8
9
10
// let's take this as an example
       case ('a'): empty_tables; 
// 1. no need for the parentheses
// 2. empty_tables() <-- here parentheses without those, your compiler thinks
// this is a variable and not a function call
// 3. you are missing a break:
case 'a': empty_tables(); break;
// without the break when your choice is an 'a' it will call the function "empty_tables()" and then 
// "party_names()" as well and so on.. (even if your choice was 'a' it's going to call all the other functions
// But with break; it will jump out of the switch statement 


Why are you calling all the functions in "main" after you called "menu(choice)" already ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int empty_tables(); // you declare this one at the beginning
// This is just a "Forward declaration" that tells your compiler: "hey, somewhere is this function...
// ... pls find it and do whatever some guy defined (implemented what it is supposed to do)

void empty_tables(char status) //and suddenly it looks like this 
// it has to be the same like above or maybe this one is right then change the declaration
// you did at the beginning
{
    cout<<"Table 1"<<endl;
    cout<<status<<endl;
}

void assign_table(int table, string &name_of_party) // this as well looks different than the one
// you declared before main (they have to match!) 


There is still lots of ways to improved. Don't give up ^.^
Last edited on
Topic archived. No new replies allowed.