0

Cpp

How can i write a code that can accept letter not the number in c++ Forexample enter name The user must have to enter its name in letter when the user enter the number it have to notify him note to use number help me guys

29th Jul 2018, 10:01 AM
bereket mekurya
bereket mekurya - avatar
3 odpowiedzi
+ 1
with cin of string data type, one can accept value as 123 because it is considered as "123" ... One should convert input to double or int and check whether conversion passes or not...
29th Jul 2018, 12:17 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
string name; cin >> name;
29th Jul 2018, 10:28 AM
TurtleShell
TurtleShell - avatar
0
https://code.sololearn.com/cY49wQLjgnId/?ref=app This will keep asking for the name until the user types the correct one. Warm regards
29th Jul 2018, 12:18 PM
Steppenwolf
Steppenwolf - avatar