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() { double x = -4; try { if (x < 0) { throw domain_error("Cannot find the square root of a negative number"); } cout << sqrt(x); } catch (const domain_error& e) { cout << e.what(); } return 0; }
Cannot find the square root of a negative number