troubleshooting Question

Why Switch Case Ends Up in an Infinite Loop When user Enters Letters? C/C++

Avatar of F-J-K
F-J-KFlag for Canada asked on
ProgrammingCC++
39 Comments1 Solution3001 ViewsLast Modified:
I have switch statement that takes an int e.g. switch(userNumber). When i type a letter from keyboard, the default: does not get implemented. I stuck in a loop. Why? How can i avoid it?

default get implemented only when user enter number that is not in the menu.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 39 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 39 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros