Question: we want the program to do the same thing, but with not one main() function, but instead one main() function PLUS one user defined function
we want the program to do the same thing, but with not one main() function, but instead one main() function PLUS one user defined function called computeConeVolume that contains the calculation. In other words, remove the one line calculation, replace it with a function call, then write and add the function below main with the calculation, surrounded any other syntax you need to complete it. in C++
- I need some help, thanks!
#include
int main() { //Declare variables and constants double coneRadius = 0.0; double coneHeight = 0.0; const double PI = 3.14; double coneVolume = 0.0;
//Prompt the user for inputs cout << "Enter the radius of the cone: "; cin >> coneRadius; cout << "Enter the height of the cone: "; cin >> coneHeight;
//Do the calculation coneVolume = 0.33 * PI * coneRadius * coneRadius * coneHeight;
//Display the result cout << "The volume of your cone is: " << coneVolume << endl;
system("pause"); return 0; } //end of main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
