1#include <iostream>
2#include <string>
3using namespace std;
4int main() {
5
6 string s = "10";
7
8 try
9 {
10 int i = stoi(s);
11 cout << i << '\n';
12 }
13 catch (invalid_argument const &e)
14 {
15 cout << "Bad input: std::invalid_argument thrown" << '\n';
16 }
17 catch (out_of_range const &e)
18 {
19 cout << "Integer overflow: std::out_of_range thrown" << '\n';
20 }
21
22 return 0;
23}