I am trying to work out a switch for a program for ordering pizzas. The user should first have a choice of of they would like to start an order or print grand totals. If they choose to print grand totals the program prints the grand totals, if they choose to start an order then the program gets input about the order and then ask if they would like to add another pizza to this order or end the order. Choosing to add another pizza gets input for the next pizza and chosing to end the order prints the information for that order. Then after that order prints the program should ask if the user wants to start another order or print the grand totals. etc, etc... This is what I have so far, the functions that I call are listed below main:
The way I have the grand total just won't print at all, even if I choose option two. No matter what option I choose in AskOrder the program asks for the input of a pizza. If I input a pizza and then say I want to end the order the program does print the order but then it asks for another pizza when it should be asking me if I want another order or if I want the grand total. Any suggestion would help thank you!Code:int main () { AskOrder (); do { do { cout<<"get input\n"; }while (AskPizza () != 2); do { cout<<"print order\n"; }while (AskPizza () != 1); }while (AskOrder () != 2); do { cout<<"print grand\n"; }while (AskOrder () != 1); return 0; } // functions int AskPizza () { int choice; cout<<"Please Choose One:\n"; cout<<"1. Add a pizza to this order\n"; cout<<"2. End this order\n"; cout<<"Selection : "; cin>>choice; switch (choice) { case 1 : return 1; break; case 2: return 2; break; } } int AskOrder () { int choice; cout<<"Please Choose One:\n"; cout<<"1. Enter an Order\n"; cout<<"2. Get Grand Totals\n"; cout<<"Selection : "; cin>>choice; switch (choice) { case 1 : return 1; break; case 2 : return 2; break; } }