I am just learning functions. I understand that the code
is a function that takes no input and returns nothing to the caller, but if I have:Code:void MegaMillion (void)
where I'm trying to get rid of all the gotos, how do I write all the goto replacement functions? What do I place inside the ()? What do I do with the label "Start?" What belongs in the () of the exit code?Code:int main () { Start: char z; cout << "For Florida MegaMillion press #1" << endl << endl; cout << "For Florida Lotto press #2" << endl << endl; cout << "For National Power-Ball press #3" << endl << endl; cout << "To start over press #4" << endl << endl; cin >> z; if (z == 1) { cout << "You have chosen to play Florida's MegaMillion Lotto," << endl << endl; MegaMillion(); } else if (z == 2) { cout << "You have chosen to play the Florida Lotto." << endl << endl; FloridaLotto(); } else if (z == 3) { cout << "You have chosen to play the National Power-Ball Lotto," << endl << endl; PowerBall(); } else if (z == 4) goto Start; else if (z != 1 && z != 2 && z != 3 && z != 4) { cout << "You have chosen to end the program." << endl << endl; exit(); } return 0; }
. . . . therry