Question: c++ 10. Design a function calculate() that takes two type double values and a pointer to a function that takes two double arguments and returns

 c++ 10. Design a function calculate() that takes two type double

c++

10. Design a function calculate() that takes two type double values and a pointer to a function that takes two double arguments and returns a double. The calculate() function should also be type double, and it should return the value that the pointed-to function calculates, using the double arguments to calculate(). For example, suppose you have this definition for the add() function: double add (double x, double y return x + y: Then, the function call in the following would cause calculate() to pass the val ues 2.5 and 10.4 to the add function and then return the add return value (12.9); double calculate 12.5, 10.4. add Use these functions and at least one additional function in the add moldina program. The program should use a loop that allows the user to enter pairs of num bers. For each pair, use calculated to invoke add () and at least one other fund tion. If you are feeling adventurous, try creating an array of pointers to adastyle functions and use a loop to successively apply calculated to a series of functions by using these pointers. Hint: Here's how to declare such an array of three pointers double double double You can initialize such an array by using the usual array mitalization syntax and function cames as addresses O is hp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!