try with single catch
#include "stdafx.h"
#include <iostream>
using namespace std;
int main ()
{
// try with single catch block
try
{
throw 20; // We need to throw an exception by passing a parameter to the corresponding catch function.
}
catch (int e)
{
cout << "An exception occured. Exception Number: " << e ;
}
return 0;
}
Output:
An exception occured. Exception Number: 20