2. Determine the output of each of the following program when it is executed. (a) #include #include using namespace std; int main() { string str; oat a = 1,b = 0.0001,quotient; try { if (b ==...




2. Determine the output of each of the following program when it is executed. (a)


#include #include










using namespace std; int main()


{


string str;


oat a = 1,b = 0.0001,quotient; try {


if (b == 0) throw str;


else


{


quotient = a/b;


cout <><><>


cout <“><>


}


}


catch (string str) {


cout <>








}


(b)




}


return 0;




#include #include using namespace std;


int a[10] = {1,2,3,4,5,6,7,8,9,10};


int main()


{


string str; int sum = 0; try {


for (int € = 0; € <=>€ >= 5)


throw str; else


{


cout <><><>


sum += a[i];


}


}


}


catch (string str) {


cout <>










}





}


cout <><><>




#include using namespace std; class abc {


public:


void display(int x, int y);


};










void abc :: display(int x, int y)


{


try


{


if (y == 0)


throw y; else


cout <><>


}


catch (int)


{


cout <>


}


}


int main()


{


abc obj; try {


obj.display(1,2);


}


catch (int)


{


cout <“exception>


}


return 0;


}










May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here