Write a complete program that prompts the user for the radius of a sphere, and calculates and prints the volume of that sphere. Use an inline function sphereVolume that returns the result of the following expression: (4.0 / 3.0 * 3.14159 * pow(radius, 3)).

What will be an ideal response?


See the following program:
```
// Inline function that calculates the volume of a sphere.
#include
#include
using namespace std;

const double PI = 3.14159; // define global constant PI

// calculates volume of a sphere
inline double sphereVolume( const double radius )
{
return 4.0 / 3.0 * PI * pow( radius, 3 );
} // end inline function sphereVolume

int main()
{
double radiusValue;

// prompt user for radius
cout << "Enter the length of the radius of your sphere: ";
cin >> radiusValue; // input radius

// use radiusValue to calculate volume of sphere and display result
cout << "Volume of sphere with radius " << radiusValue
<< " is " << sphereVolume( radiusValue ) << endl;
} // end main
```

Computer Science & Information Technology

You might also like to view...

The region in a program where a particular name is visible or can be referenced is called the name’s ______________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Microsoft Intune requires an on-premises server infrastructure before it can be deployed.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

PowerPoint software MUST be installed on a computer system in order to view a PowerPoint presentation

Indicate whether the statement is true or false

Computer Science & Information Technology

A wildcard character used as the first and/or the last character in a character string to match any number of characters is the ____ character.

A. # B. + C. ? D. *

Computer Science & Information Technology