dont use gets. it leads to buffer overflow.

use ->

Code:
--
--
char age[2];
int len;

a:
gotoxy(1,1);
cout<<"enter name : ";
cin.getline(age,2,'/n');

len=strlen(age);
switch(len)
{
case 1:
      if(!isalpha(age[0]))
      {
       cout<<"Error in inputting number : "; 
       goto a;
      }
break;
case 2:
      if(!isalpha(age[0]) && !isalpha(age[1]))
      {
       cout<<"Error in inputting number : "; 
       goto a;
      }
break;
}
--
--

this is just roughly what you have to do. not tested this

now before you all start flaming me for using goto just check if there is any instance where it will bypass any code or runaway with the program