0

i have a problem and i can not solve it. Problem is that for example there is an admission form on internet and a student enter his name in digits no dought it is wrong and now here is a problem how to restrict the student that he/she should not enter his name in wrong data type. so it is necassary to compare the data type. if same then proceed otherwise terminate. now what will be the condition. on data type.

string name;
cout<<"Enter your name";
getline(cin,name);
if(name!=string)
cout<<"wrong entry";

is it true

3
Contributors
4
Replies
18
Views
3 Years
Discussion Span
Last Post by Ancient Dragon
0

Look at each char in the input string.

If any of them are digits (isdigit), disallow.

Edited by Moschops

0

student enter his name in digits no dought it is wrong

Not necessarily -- depends on where you live. In some places it might be perfectly legal to name a baby R2D2.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.