Checking for a char input to be only a letter

When asking for a char from the user, how can I check to make sure it is a letter and then re-ask them to input it if needed
@Shadoninja

Here's how I'm doing it, while getting the input if the user wants the computer to start first, or the human.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
	int PlaceIt;
	int row,col;
	int r[5]={4,3,2,1,0};
	char place[2];
	SetConsoleTextAttribute (console, 62);
	do{
		col=0;
		row=0;
		do
		{
			gotoXY(23,28,"Place at ?(A1...E5)?:   \b\b\b");
			cin >> place;
		} while (toupper(place[0])<'A'||toupper(place[0])>'E'|| place[1]<'1' || place[1]>'5');

		col = (toupper(place[0])-64);
		row = r[(place[1]-49)];
		PlaceIt = (col+(5*row));
		if ( b[PlaceIt]==1)
		{
			gotoXY(23,28,"You're using that space.");
			Sleep(1500);
		}
		if ( b[PlaceIt]==2)
		{
			gotoXY(23,28,"Sorry, that space taken.");
			Sleep(1500);
		}
		if ( b[PlaceIt]==0)
		{
			gotoXY(23,28,"Inserting your checker. ");
			Sleep(1500);
		}

	} while (PlaceIt <1 || PlaceIt >25 || b[PlaceIt]!=0 );
	b[PlaceIt]=1;
}


I check the left char input and then the right, to see if they are within the boundary's of the desired inputs. Even if the user types in 3 or 4 characters, only the first one is checked for alpha, and the second, for numbers.
And by using toupper(), I don't have to check lower case as well as upper case.
Hope this helped out.

NOTE: Please disregard the gotoXY(... ); and SetConsoleTextAttribute ( ...); as I use these to set screen locations for cout and for screen colors.
Topic archived. No new replies allowed.