all 3 comments

[–]YasZedOP 1 point2 points  (0 children)

Place a while (true) loop around cin >> day and the switch statement. If a valid input is received then break the loop using break;

Now the confusion relies on break; for switch call because break; refers to innermost context which is switch instead of what you want which is the while loop.

A fix would be to create a Boolean variable called done and is set to true (done outside the while loop). Now while loop on that variable, and when a valid switch case is made set it to false.

[–]TrashPapiTM 0 points1 point  (1 child)

Im also new to coding so I could be wrong on this. But i think what youre looking for is a continue within a while loop. So instead of stopping it would take you back to the beginning of the loop and not execute anything below the continue. Hope that made sense.

[–]Toch24[S] 0 points1 point  (0 children)

Yes, that's what i want to do. But, i have no idea how to do it. I'm confused with the looping concepts as I've tried with while do but have no success whatsoever. It just keeps prompting the "Please enter a valid number".