catch statment c++ code example
Example 1: c++ try
try {
//do
} catch (...){
//if error do
}
Example 2: exception handling c++
// exceptions
#include <iostream>
using namespace std;
int main () {
try
{
throw 20;
}
catch (int e)
{
cout << "An exception occurred. Exception Nr. " << e << '\n';
}
return 0;
}