179k views
2 votes
The hypotenuse function is correct, but the main function has a problem. Explain why it may not work, and show a way to fix it. Your fix must be to the main function only; you must not change the hypotenuse function in any way.

User Dennison
by
7.8k points

1 Answer

1 vote

Answer: hello your question is incomplete attached below is the missing codes

Answer : It may not work because; the double pointer P was not allotted a double using a new double ( I.e. Error in the main function ) also the cout statement was not written in the main function

Explanation:

It may not work because; the double pointer P was not allotted a double using a new double ( I.e. Error in the main function ) also the cout statement should be moved to the Main

The correction is below

{

double* p = new double;

hypotenuse(1.5, 2.0, p);

cout << "The hypotenuse is " << *p << endl;

}

The hypotenuse function is correct, but the main function has a problem. Explain why-example-1
User YDelouis
by
7.2k points