You are viewing a single comment's thread. Return to all comments →
C++
int main() { string S; getline(cin, S); int t; try{ t= stoi(S.c_str()); cout << t; } catch (const exception& e){ // cout << e.what() << endl; cout<<"Bad String"; } return 0; }
Day 16: Exceptions - String to Integer
You are viewing a single comment's thread. Return to all comments →
C++