#include #include #include using namespace std; int ErrorCode = 0 ; int divideOperation1( int x1, int y1 ) { ErrorCode = 0 ; if ( y1 == 0 ) { ErrorCode = -1 ; return 0 ; } return ( x1 / y1 ) ; } int divideOperation2( int x1, int y1 ) { ErrorCode = 0 ; if ( y1 == 0 ) { throw "Divide by zero." ; //throw String("Divide by zero.") ; } return ( x1 / y1 ) ; } int main() { divideOperation1 ( 4 , 0 ) ; if ( ErrorCode == -1 ) cout << "Error divisor is zero." << endl ; try { divideOperation2 ( 4 , 0 ) ; } //catch ( const string& str1 ) catch ( const char* str1 ) { cout << str1 << endl ; } return 0; }