Hi,
I need help coding a loop with a switch. The outcome I want is when the user inputs a invalid number the menu will loop again allowing the user to input a valid number.
Can I please have some ideas on how I could do this?
Hi,
I need help coding a loop with a switch. The outcome I want is when the user inputs a invalid number the menu will loop again allowing the user to input a valid number.
Can I please have some ideas on how I could do this?
Put it in a do/while loop with the condition being input not being in the range of a correct input
Fact - Beethoven wrote his first symphony in C
replace the while with do and put the while at end of switch with a valid condition checking.
This is for C++, but the loops shown are the same in both languages:
For, While, and Do While Loops in C++ - Cprogramming.com
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"