Ok, I've beat my head on the wall for over a week on this issue and I'm just over it at this point. Here's the code I have, I'll post the issue at the bottom of the code. As a side note, I am a first time computer guy who would classify himself in the super uncomfortable with this stuff category, so please, any tips, tricks, etc would be amazing.
int height;
do { printf("Please provide a number between 1 and 23: "); height = GetInt(); } while (height < 0 || height > 23); { printf("%i is not between 1 and 23, please try again: ", height); height = GetInt(); }
UPDATE
I have updated the code to the DO/WHILE loop I am running
Now with the DO/WHILE loop the program does not run correctly at all. If you enter a valid number, you have to enter it again because it tells you it was incorrect, like this:
jharvard@appliance (~/Dropbox/pset1): ./mymario2 Please provide a number between 1 and 23: 3 3 is not between 1 and 23, please try again: 3 # ##
#
jharvard@appliance (~/Dropbox/pset1):
If I repeatedly enter an invalid number, it will re prompt, but it uses the incorrect prompt:
jharvard@appliance (~/Dropbox/pset1): ./mymario2 Please provide a number between 1 and 23: 24 Please provide a number between 1 and 23: 24 Please provide a number between 1 and 23: 24
The other issue with this loop is that if 0 is used repeatedly, the program will again terminate, but it at least uses the correct prompt:
jharvard@appliance (~/Dropbox/pset1): ./mymario Please provide a number between 1 and 23: 0 0 is not between 1 and 23, please try again: 0 jharvard@appliance (~/Dropbox/pset1):
With the IF/ELSE IF loop I was running previously it would work either way, it just wouldnt re prompt the user a second time if a second invalid number were entered. At this point I dont know where else to go, as I previously stated, ive tried all manner of different loops but none will work. I think Im going to revert back to my IF/ELSE IF loop and just submit and be done with it. As a very beginning, first time programmer this is just too damn frustrating.