Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
#include
#include
#include
using namespace std; int main() { int a = 2000000000; int b = 2000000000; try { if (a > INT_MAX - b) { throw overflow_error("The result is too big for an int"); } cout << a + b; } catch (const overflow_error& e) { cout << e.what(); } return 0; }
The result is too big for an int