Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- int main(){
- string input = "asdasd123";
- int number;
- try{
- number = stoi( input );
- }catch(invalid_argument e){
- cout << "Что-то не так" << endl;
- number = -1;
- }
- cout << "Номер " << number << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment