Consider the following functionnbsp which of the following


Consider the following function:  Which of the following would be the best way to call this function?

void Division(const double a, const double b)
{
    double Result;

    if( b == 0 )
        throw "Division by zero not allowed";

    Result = a / b;
    
    cout << "n" << a << " / " << b << " = " << Result;
}

Which of the following would be the best way to call this function and pass it the value 2.0 for a and the value 0 for b?

 

A.     catch( Division(2.0, 0))
    {
        cout << "nBad Operator: " << Str;
    }
B. try {
        Division(2.0, 0);
    }
    
C. try {
        Division(2.0, 0);
    }
    catch(const char* Str)
    {
        cout << "nBad Operator: " << Str;
    }
D.
    Division(2.0, 0);
    throw();
    catch(Exception ex)
    {
        cout << "nBad Operator: " << Str;
    }

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Consider the following functionnbsp which of the following
Reference No:- TGS01190602

Expected delivery within 24 Hours