this is my code and problem is with the space between months and years::
for(;;){
char TmpAge[10];
cout<<"What age is the pet? (yy mm ) => ";
cin.getline(TmpAge,MaxChars);
if(strlen(TmpAge)==0){PetRecs[NumRecs].Age.Mths = PetRecs[NumRecs].Age.Yrs =-1; break;}
else if(is_number(TmpAge)==false){
cout<<"Invalid input1!\n"<<endl;
continue;
}
else{
sscanf(TmpAge,"%d %d",&PetRecs[NumRecs].Age.Yrs, &PetRecs[NumRecs].Age.Mths);
if( PetRecs[NumRecs].Age.Mths >= 0 &&
PetRecs[NumRecs].Age.Mths <= 11 &&
PetRecs[NumRecs].Age.Yrs >= 0 &&
PetRecs[NumRecs].Age.Yrs <= 50)
break;
else{
cout<<"Invalid input2!\n"<<endl;
continue;
}
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++
bool is_number(char Tmp[])
{
for (int i = 0; i < MaxChars; i++) {
if (!isdigit(Tmp[i])&&((Tmp[i])!='\0')){
cout<<Tmp[i]<<" ="<<i;
return false;
}
else
continue;
}
return true;
}