(Circle Area) Write a C++ program that prompts the user for the radius of a circle, then calls inline function circleArea to calculate the area of that circle.
What will be an ideal response?
// Use inline function to calculate circle area.
#include
using namespace std;
double pi = 3.14159; // global variable
// circleArea is inline function that returns area of circle
inline double circleArea( double r )
{
return pi * r * r; // return area
} // end function circleArea
int main()
{
double radius; // user entered radius
// prompt for radius
cout << "Enter the radius of the circle: ";
cin >> radius;
// calculate and display area of circle
cout << "The area of the circle is " << circleArea( radius ) << endl;
} // end main
You might also like to view...
When creating a bulleted or numbered list, each time you press the _____ key, PowerPoint generates a new bullet or number.
A. Enter B. Space C. New Bullet D. New Item
Which of the following is TRUE about PowerPoint 2013?
A) A page is the most basic element of a PowerPoint presentation. B) A PowerPoint slide show can run automatically at a kiosk. C) A PowerPoint slide show cannot be displayed on the World Wide Web. D) A PowerPoint presentation is saved with a .ptt extension after the filename.
White space is white and void of content
Indicate whether the statement is true or false.
Hashing is a key-to-address mapping process.
Answer the following statement true (T) or false (F)