I am trying to write a simple program for a class.
I have it all complete except for trying to verify user input.
I want input to only be an integer between 1 and 999.
You can't do it like that. If the first cin fails, the value of guess is undetermined when you do the first check. Calling cin.clear() only makes sense when cin is in a fail state (for example, you tried reading an int, but encountered characters instead). I don't know exactly why cin behaves that way for you, but I can at least tell you that /n is not a character... I think you're mixing that up with '\n', though you probably got that right in your code.