If you want the second, which I think you do, you will have to deal with the possibility that you may have several "Enter correct letter" statements on the screen if you have a dumb user.
The only alternative is to use some sort of console manipulation library (e.g.
But those are complicated and too much effort for your project I think.
The space tells scanf() to skip invisible characters (\n \t \b spaces etc) before %c ...
but scanf() is a lot more complex than that, it can do some pretty amazing stuff if you know how to set it up.
This post has been edited by r.stiltskin: 29 February 2012 - PM Your test for cin.fail() will always evaluate to false (if you entered the loop), because you are clearing the fail flag with cin.clear(). You are saying in your if that the numbers must be less than 1 or the numbers should be greater that 34, meaning that the numbers 1 to 34 are invalid.
Basically this function checks if the user input 1) a valid letter character, and 2) the user enters either A or P, and this is case-sensitive.