-
What is the output of this program?
#include
using namespace std;
double function(int p, int q)
{
if (q == 0)
{
throw "Division by zero condition!";
}
return (p / q);
}
int main ()
{
int m = 100;
int n = 20;
double Res = 0;
try
{
Res = function(m, n);
cout << Res;
}
catch(const char *message)
{
cout << message;
}
return 0;
}
-
- 4
- 20
- 100
- Compilation Error
- None of these
Correct Option: A
In this program, we resembling the division by using the exception handling.