Catching letters and symbols

I'm trying to setup a function that will know when a user enters the wrong kind of input, then start that function over. In this function I'm asking the user for a number 1-5. If they enter anything less, or a letter, or a symbol I want to start the function over.


1
2
3
4
5
6
7
8
9
10
11
12
int fSetColorChar(int Character)
{
	//Writes File For Character Color
	cout << "What Color Would You Like All ~Letters Returned~ To Be:\n1.) Blue\n2.) Red\n3.) Yellow\n4.) Green\n5.) Orange\n\t\t===> ";
	cin >> Character;
	if (//if the user enters the wrong input I want to catch them here)
        {
	//----------
	}
	//ofstream write file will go here.
	return Character;
}


on the line cin >> Character; if the user enters "a" or any other letter/symbol, I want the fSetColorChar() to start over.
Topic archived. No new replies allowed.