0
GET ONY INTEGER FROM USER
How can I get only int from user? if user's input is not integer show message please eneter number instead of alpha then get input from user then save it in array again
4 Respostas
+ 6
int a;
try {
cin >> a;
}
catch (Exception){
cout << "Please input an integer value";
int a =0;
return 0;
}
+ 2
@K2 Shape, is your code compiling?
0
@K2 Shape can you edit my last code ..?
project polynomial
0
cin doesn't use exceptions unless you call cin.exceptions()
Proof:
http://stackoverflow.com/questions/26187729/stdcin-doesnt-throw-an-exception-on-bad-input
http://en.cppreference.com/w/cpp/io/basic_ios/exceptions