-
What is the output of this program?
#include <iostream>
using namespace std;
void Example(int num)
{
try
{
if (num > 0)
throw num;
else
throw 'U';
}
catch(int num)
{
cout<<"Integer: "<< num << endl;
}
catch(char ch)
{
cout << "Character: " << ch;
}
}
int main()
{
Example(12);
Example(0);
}
-
- Integer: 12
- Character: U
- Integer: 12
Character: U - Character: U
Integer: 12 - None of these
Correct Option: C
We are passing the integer and character and catching it by using multiple catch statement.