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

  Write a for loop that adds the integers

Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized. Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result .

  Write down a program which will calculate and displays min

write down a program which will calculate and displays the min temperature and the maximum temperature for seven days of a week.

  Create a text adventure game that uses pointers

Create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased.

  Write the class declaration for a class named complex

Write the class declaration for a class named Complex using the class diagram

  Write the definitions of the member functions

Write the definitions of the member functions of the class complexType as designed and Rewrite the definition of the class complexType

  Takes n number of element from user

Write a C program which takes n number of element from user (where, n is specified by user) and stores data in an array. Then, this program displays the largest element of that array.

  Write a c++ program that reads a set of integers

Write a c++ program that reads a set of integers and then finds and prints the sums of the even and odd numbers.

  Compute the average of each row

Write a program that prompts the user to enter 15 double numbers from the keyboard and save them into a 3 by 5 array in the main ( ). Then call a user-define function to compute the average of each row and print the original matrix and average of ..

  What is the big-o run-time of the c++ function

What is the big-O run-time of the following C++ function

  Prepare a main function

Write a function that converts an input of some integer number of nickels into outputs of integer numbers of dollars, quarters, and nickels.

  Write a c program that copies the contents of one file

write a c program that copiest the contents of one file to a destination file. This program works by first prompting the user for the name of the source file and destination file.

  Write a loop that will show the price of silver and gold

Write a loop that will show the price of silver and gold for 1 to 16 ounces in one ounce increments.

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