Cpp | SoloLearn: Learn to code for FREE!

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

7/29/2018 10:01:17 AM

bereket mekurya

3 Answers

New Answer

+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...

0

string name; cin >> name;

0

https://code.sololearn.com/cY49wQLjgnId/?ref=app This will keep asking for the name until the user types the correct one. Warm regards