I keep getting while loop errors in MSVS 2013.
The errors are intellisense expected a while on lines 100 and 103 and error C2059 expected a '}' on lines 100 and 102. Please help me. I'm so lost.
You have the starts of do..while loops on lines 31 and 38, but there's only one while on line 95 while (choice = 'q');, which doesn't seem to match up. (Also - I think you want the equality operator == there, not assignment =.)
Hi! Thank you for the response. I do have a while statement on line 59 however. Thank you for pointing out the assignment operator btw. So I'm still not sure why I would get these errors because I have do have a while statement on line 59
Sorry I missed that earlier while. That while seems to be part of the default case of the switch statement.
1 2 3 4
while (choice != 6)
{
mainMenu();
}
I think this is what the code is trying to do with the nested loops and switches? Outer do..while controls the main menu of math options until they choose to quit the program, inner do..whiles control the difficulty submenu for each math type until they choose to stop working on that math type.
(I've pulled out the interior code of the cases and made separate choice variables local to main instead of a single global choice, assuming the menu functions return a value.)
int main()
{
srand(time(NULL));
char arithmeticchoice;
int difficultychoice;
do
{
arithmeticchoice = mainMenu();
switch (arithmeticchoice)
{
case'a':
do{
difficultychoice = difficultyMenu();
switch (difficultychoice)
{
// cases
}
}(while difficultychoice != 6) // break out of this loop if they want to stop with addition)
break;
case'b':
do{
difficultychoice = difficultyMenu();
switch (difficultychoice)
{
// cases
}
}(while difficultychoice != 6) // break out of this loop if they want to stop with subtraction)
break;
//other cases for multiplication and division
} // end switch on arithmetic choice
}while (arithmeticchoice != 'q'); // break out of this loop if they want to quit program
return 0;
}// end main