anyone can try for me??
when i type in '5' but it still continue to ask me type in fraction.
but if 'choice != 1,2,3,4,9'... i have to show out 'Invalid Selection'
and when my choice is '9'..it show me what i want but got the 'Invalid Selection' there
can help me solve the problem??
my question were ask me to show out
____________________________________________________________________________
1 > Please Enter Your Choice : 5 (other than 1,2,3,4,9)
Invalid Selection
2 > For fraction 1
Enter the numerator : 3
Enter the denominator : 0
The denominator must be nonzero.
Enter the denominator :
_____________________________________________________________________________
but when i choose the choice as '5'
it will ask me to type in fraction1 and fraction2 then show me the 'Invalid Selection'
how can i make it show me 'Invalid Selection' only if i type the choice other than '1,2,3,4,9'??
and same case with the 'The denominator must be nonzero'...and how to make it re-ask me to type in again the denominator
Right because the if(choice != 9) {... only tests for that one condition, that the choice entered is not '9', then continues to ask for the input of the fraction, if you enter the info by the time you hit the switch statement your code will operate as you expect.
You just have to change what you are evaluating at this point in the code. Try something like:
It should. When the user enters 9 as a choice at the "Would you like to continue..." part of the code it should go back to the while(choice !=9) and see that choie IS equal to 9 and quit. Unless you are getting stuck at a new loop. Could you copy paste your current code in the void menuFunction() function?
EDIT: I meant to ask for your current version of your void menuFunction not your main().