Hi I've been having issues trying to get the choice 5 to function properly. This program is supposed to function as a math tutor and after each choice input (other than 5), after solving the problem, the user should be brought to the main choices once again. Currently what I have forces the program to shut down after the first answer is input. Can someone tell me if I'm missing something?
For the if statements you do not need to check both ways. This will work:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
if (inputadd == cadd)
{
cout << endl;
cout << "Congratulations, that is correct!" << endl;
cout << "The answer is " << cadd << "." << endl;
cout << endl;
}
else
{
cout << endl;
cout << "Sorry, that is incorrect!" << endl;
cout << "The answer is " << cadd << "." << endl;
cout << endl;
}
The only concern I had was a divide by zero, but if I understand random number generation correctly the smallest number it will return is one.
After the menu the two if statements can be shortened to:
1 2 3 4 5 6
if (choice < 1 || choice > 5)
{
cout << endl;
cout << "Please enter in a number (1-5) that corresponds with the choice that you want on the menu.";
cout << endl;
}