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)).
```


```
// Exercise 6.10 Solution: ex06_10.cpp
// 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);
}

int main() {
// prompt user for radius
cout << "Enter the length of the radius of your sphere: ";
double radiusValue;
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;
}
```

Computer Science & Information Technology

You might also like to view...

The identification of vulnerabilities is usually done through ____ tests.

A. network B. application C. penetration D. protocol

Computer Science & Information Technology

Which of the following statements is used when you want to add data to the end of an existing text file?

(A) ``` Dim sr As IO.StreamReader = IO.File.OpenText("Data.txt") ``` (B) ``` Dim sr As IO.StreamReader = IO.File.AddText("Data.txt") ``` (C) ``` Dim sw As IO.StreamWriter = IO.File.CreateText("Data.txt") ``` (D) ``` Dim sw As IO.StreamReader = IO.File.AppendText("ata.txt" ```

Computer Science & Information Technology

In order for computers to share resources efficiently, they can be linked together in a structure called a network.

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

Computer Science & Information Technology

Match each item with a statement below.

A. Does extensive preprocessing of the evidence items and organizes the various items into a tabbed display B. A technique in which a term is extended via links to subsidiary terms C. Recovering files, images, and so forth from fragments in free space D. Has a set of all the portable equipment and tools needed for an investigation E. Device that allow you to acquire the information on a drive without accidentally damaging the drive's contents F. Drying agents to absorb any moisture G. Presents an extensible forensic platform that makes it easy for trained investigators to carry out their tasks H. Must be disclosed I. An enclosure that ensures that electromagnetic waves are blocked so that a device cannot transmit or receive radio waves while in custody

Computer Science & Information Technology