-
What is the output of this program?
#include <stdexcept>
#include <limits>
#include <iostream>
using namespace std;
void Function(int ch)
{
if (ch < numeric_limits:: max())
throw invalid_argument("Function argument too large.");
else
{
cout<<"Programs Executed...";
}
}
int main()
{
try
{
Function(150);
}
catch(invalid_argument& excep)
{
cout << excep.what() << endl;
return -1;
}
return 0;
}
-
- Function argument too large.
- Compilation Error
- Programs Executed...
- Runtime Error
- None of these
Correct Option: C
As we are throwing the function and catching it with a correct data type, So this program will execute.