Question: When asked to create a program to find the volume of any cone. given its radius and height, a programmer created this program to

When asked to create a program to find the volume of any 

 cone. given its radius and height, a programmer created this program to 

When asked to create a program to find the volume of any cone. given its radius and height, a programmer created this program to implement the formula V = It compiles, and it runs, but it gives completely incorrect results. A serious problem lies in the ComputeVolume function. Additionally, the programmer was confused about parameters and local variables. Make this function work correctly, and also improve its use of parameters, changing main as necessary. Note any other minor or stylistic errors you might and throughout the program. You can simply note changes on the program listing. double ComputeVolume ( double r, double h, double ans double r2 ) int main () { double radius , height , ans , r2; cout

Step by Step Solution

3.56 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 The code will always return 0 Hence the volume for any values of radius and height is always 0 Thi... View full answer

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 Programming Questions!