#include #include #include using namespace std; int divideOperation2( int x1, int y1 ) { if ( y1 == 0 ) { cout << "Step1" << endl ; throw "Divide by zero." ; //throw String("Divide by zero.") ; } return ( x1 / y1 ) ; } void method1( string str1 ) { cout << "Inside method1: " << str1 << endl ; } int main() { try { string str1 = "Divide by zero." ; method1( str1 ) ; const char* str2 = "Divide by zero str2." ; method1( str2 ) ; string str3 = str2 ; divideOperation2 ( 4 , 0 ) ; } catch ( const string& str1 ) //catch ( const char* str1 ) { cout << "Step2" << endl ; cout << str1 << endl ; } cout << "Step3" << endl ; return 0; }