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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started