0
How do i format a block of code to only receive data in string form and reject integers and vice versa?
I am trying to format a code that receives (for example) your name and displays an error message if you input numbers...kindly help.
2 Réponses
0
try with cin.fail() after getting user input of string type... I guess it might not fail for 123 as input as 123 might be considered as "123"... If so, try to convert string to double and integer... if it succeed, clear input...
-HIH
Ketan
0
look at this code:
https://code.sololearn.com/cNG9tsFXDaNP/?ref=app