Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 using namespace std;

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

How did you feel about taking piano lessons as a child? (general)

Answered: 1 week ago