+ 1

we define int a and waiting user to input and we assing it to a but what if user's input is not a integer ?

C++ Input

11th May 2017, 10:59 PM
SeciuS
3 Antworten
+ 6
Then the program crashes as an int cannot be assigned as a string. Use a try catch to handle this.
11th May 2017, 11:09 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Yes. As Rrestoring said, always check the inputs with try
11th May 2017, 11:16 PM
Adrià
Adrià - avatar
+ 2
Ty so much guys
11th May 2017, 11:17 PM
SeciuS