#include #include using namespace std; void ShowTry(int);// prototype int main() { cout << "Start main --->"; //declaring variable int n1, n2; string str1; here: // reference to goto function cout<< "\n Enter n1, say 40 : "; cin>> n1; // if logical control statment with == compare operator //code won't allow the users to intialize an integer with 0 //if(n1==0){ cout<< " 1st number is Zero ";goto here;} //there: cout<< " Enter n2 say 2 : "; cin>> n2; //if(n2==0){ cout<< " 2nd number is Zero ";goto there;} cout << "\n Entering Try Block "; try { cout << "\n Inside the try block "; if((n1==0)||(n2==90)) { ShowTry(90); cout << " \n quit here "; exit(1); } else { ShowTry(n1/n2); goto here; } // in C++ divide by zero will not complie cout <<" would you like to run again ? y or n : "; cin>> str1; if(str1=="y"){ goto here;} if(str1== "n"){ exit(1);} } catch(int i) { cout<< " Forced to qut wtih an exception-- value is " << i; //exit(1); } cout << "\n No final block in C++"; cout << " end of the run"; return 0; } void ShowTry(int test) { cout << "\n --> Inside ShowTry, test is :" << test << "\n"; if(test==int("")){throw test;} if(test < 10){throw test;} if(test==90){throw test;} }