Question: Need help creating a function that does the following: Complete the `trapezoidArea` function that returns a double pointer that points to a memory location with
Need help creating a function that does the following:
Complete the `trapezoidArea` function that returns a double pointer that points to a memory location with the area of the trapezoid.
Your solution to this problem must meet the following criteria.
1. You must implement the `trapezoidArea` function in `trapezoid_area.cpp` file to return a `double` pointer.
Here's the header function in trapezoid_area.h:
trapezoid_area.h code:
double *trapezoidArea(double base_a, double base_b, double height);
1. Below is an example of a call to the `trapezoidArea` function which you could implement in `test_driver.cpp` to test your function.
**C++ Code:**
```c++
#include
#include "trapezoid_area.h"
int main() {
double* result = trapezoidArea(10, 5, 3);
std::cout << "The area is " << (*result) << std::endl;
return 0;
}
```
**Output:**
```html
The area is 22.5
```
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
