Examveda

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int age = 0;
    try 
    {
        if (age < 0) 
        {
            throw "Positive Number Required";
        }
        cout << age;
    }
    catch(const char *Message)
    {
        cout << "Error: " << Message;
    }
    return 0;
}

A. 0

B. error:Positive Number Required

C. compile time error

D. runtime error

Answer: Option A


Join The Discussion

Related Questions on Functions and Procedures in C plus plus