I am currently making a console program and i want the user to give a number from 1-5.And i want to be able to check if he entered a value out of the range 1-5 or an alphabetic character,
I managed to solve the problem with numbers lower than 1 and numbers bigger than 5
but when user enters an alphabetic character it creates an infinite loop.
How can i prevent the infiite loop from happening ?