Guest User

Untitled

a guest
Mar 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdexcept>
  3. using std::cout; using std::endl;
  4. int main() {
  5. try {
  6. int a = std::pow(2, 31) - 1;
  7. cout << a << endl;
  8. int b = 1;
  9. int c = a + b;
  10. cout << c << endl;
  11. } catch (std::overflow_error ex) {
  12. cout << ex.what() << endl;
  13. }
  14. return 0;
  15. }
  16.  
  17. 2147483647
  18. -2147483648
Add Comment
Please, Sign In to add comment