Consider the following function

Assignment Help C/C++ Programming
Reference no: EM13897409

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;
    }

Reference no: EM13897409

Questions Cloud

Copy a multidimensional array : You have the following macro statements: #define WIDTH 5#define HEIGHT 3 You wish to copy a multidimensional array called anArray declared as follows:
What is difference between market value and investment value : What is the difference between market value and investment value? Explain your answer. What does IRR measure?  What is the decision rule? What does NPV measure?  What is the decision rule?
Analysis of a fictional character : Prepare an analysis of a fictional character. Include descriptions and cited examples for each of the following methods for characters development:
Macro definitions : Given the following macro definitions #define HEIGHT 3#define WIDTH 5 There is a multidimensional array called anArray declared as follows:
Consider the following function : Consider the following function:  Which of the following would be the best way to call this function?
The compiler to send the exception : When the throw keyword is written by itself, it is a way of asking the compiler to send the exception to another handler. If there is no other handler written by you, what happens?
Complete the equation below : The equation below shows the final product in the reaction of propan-1-ol with potassium permanganate in acidic solution. Draw the structure of the compound that forms initially in this reactionn.
Using which of the following techniques in c++ : Using which of the following techniques in C++ is it possible to have different functions with the same name?select all that apply
Which of the following is a pure abstract function : Which of the following is a pure abstract function?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a bitoutputstream

Implement a class named BitOutputStream, as shown in Figure for writing bits to an output stream. The writeBit(charbit) method stores the bit in a byte variable. When you create a BitOutputStream, the byte is empty

  Write a program that find the average time spent programming

Write a program that finds the average time spent programming by a student each day over a 3 day period.

  Program which calculates the average and sum of the numbers

write down a program which calculates the average and sum of the numbers enter by a user.Using a While Loop

  Implement a class to represent a matrix

Implement a class to represent a matrix. While doing this exercise, you are allowed only to use C++ primitive types and arrays. You may not use STL in your Matrix definition. You must use dynamic memory.

  Declare and define constructor

Declare and define constructors and Declare and define destructors - Describe what is an attribute or data member of a class

  Program to read in the number of a month

Program to read in the number of a month and output the name of the month. Then the user is asked if they want to know the number of days in that month and if so output the number of days

  Implement a standard sorted linked list class

Write C++ Program:Implement a standard SORTED linked list class. Be sure to include constructor/copy constructor, destructor, and assignment operator overload.

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  Objectivein this assignment you read a list of employees

objectivein this assignment you read a list of employees from a csv file and convert them into corresponding objects.

  Conditional statementsquestion 1 write a program that

conditional statementsquestion 1 write a program that computes the cost of a long distance call. the cost of the call

  Scenario 1: a thief enters your dwelling

Scenario 1: a thief enters your dwelling and steals your computer.is it possible likely that he steals your backup device with backup copies? how do you recover from such an incident?

  Write a program which initialize an integer array

Write a program which performs the tasks - return the control to main( )and print the new array elements in main.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd