adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        int age=5;
        try 
        {
            if (age < 0)
                throw "Positive Number Required";
            cout  << age << "\n\n";
        }
        catch(const char* Message)
        {
            cout << "Error: " << Message;
        }
        return 0;
    }

a.

5

b.

10

c.

15

d.

Positive Number Required

Answer: (a).5

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?