Hi, i'm in a small programming contest at school, and one of the big factors in judging the programs is going to be how well it handles input errors. I had an idea that would look really good to judges-- Is there a way to limit input from the user such as them only being able to enter numbers, or only the alphabet, maybe even two certain letters like (Y/N). If there isn't a way to do that, i'd really appreciate any other ideas to handle input error besides:
And you could design special functions to ask the user for input from a certain type and with certain limits (eg: int inputInt(int min, int max);) that validate the input and keep asking when the input is invalid. I would use do-while loops.