### Need help with code

This is a math tutor program. I am having an issue when I enter -1 to exit to the main menu it is not working. any help will be appreciated.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394`` `````` // This program is a math tutor #include #include #include #include using namespace std; void getMenu (int &); void addition (int, int); void getRandon ( int &, int &); int main() { int num1, num2; int choice; getMenu(choice); do { getRandon (num1, num2); switch (choice) { case 1: addition(num1,num2); break; } } while (choice != 6); return 0; } void getMenu(int &rchoice) { cout << "Menu \n\n" << "1. Addition \n" << "2. Subtraction \n" << "3. Multiplication \n" << "4. Division \n" << "5. Modulus \n" << "6. Quit \n\n" << "Enter your choice: "; cin >> rchoice; while (rchoice < 1 || rchoice > 6) { cout << "Enter a choice in the range of 1 - 6: \n"; cin >> rchoice; } } void addition (int n1, int n2) { int answer; int countCorrect = 0; int countIncorrect = 0; //do //{ cout << "What is " << n1 << " + " << n2 << endl; cout << "Enter your answer or (-1 to return to the menu.)\n"; cin >> answer; if (answer != -1) { if (answer != n1 + n2) { cout << "No. Try again!\n"; cin >> answer; } else { cout << "Very Good \n"; } } //} while (answer != -1); } void getRandon (int &rNum1, int &rNum2) { srand(time(0)); rNum1 = 1 + rand() % 50; rNum2 = 1 + rand() % 50; } ``````
Topic archived. No new replies allowed.