Hi guys I am writing a restaurant ordering system,the code is pretty sloppy and I will need to break it into more functions(tidy it up) anyway I have come across a problem for some reason when my list of items are empty when I type 7 when the program starts up it will print nothing as expected but seems to return even though I use a break statement
What is it supposed to do in the other cases? If you want to print the menu again you need a loop.
It doesn't matter what case, die function will end with an invalid result. The compiler should have at least warned you due to the missing return at the end.
very good point coder777 I added return true after the switch so if the switch breaks then it will return true if gets into the test case 9 only then will it return false
also the loop is written in main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
int total = 0;
vector<food> items;
while(true)
{
if(!order(items))
{
break;
}
}
}