Exception handling in C++ is done using try, catch, and throw.
try
catch
throw
try { throw 20; } catch (int e) { cout << "An exception occurred: " << e; }
Use throw to raise an exception and catch to handle it gracefully.