Hello everyone,
My program requires that I use a menu for the user to select an option. The options are 1,2,3, or D(Exit). My issue is that my function will recognize and validate numbers but not letters. For example, if I input a 4 it will loop until I get a 1,2,or 3; on the other hand, if I input a f, it will go through the loop infinitely without giving a prompt. Same goes for all letter including D. I tried changing choice to be a unsigned char but that messed up my options for displaying later on in the program, so it needs to be an int. Any help would be appreciated.
Question: are you locked in to using numbers for menu choices and a character for the exit option? Aka if this is a school assignment or something similar for academic needs, are those the instructions you absolutely need to follow?
Because otherwise I would give your menu options E(mpty), M(odify), O(ccupied), D(one) and have your choice as a char type.
I am locked into using 1,2,3, and D (exit). I tried to change the 1,2,3 into a char, which works for that particular function, but when I go to display it doesn't recognize the char, because its set up to see it as an int.
Are you talking about reading the input as a char and validating it, than changing it back to an int? I guess I'm not sure how to go about doing that.
My name is Joe; although, I think San Jose would be a cool place to live, I never lived there before.