Maybe use this as a pattern. You probably don't have to give alternatives. Also, look up the formulae on line for the various geometric properties if you don't know them. There are plenty of sites, including wikipedia.
#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
constdouble PI = 3.1415; // Put this here as a global constant (cmath also has a built in PI)
// Also PI is double not integer
//JUST COPY FROM PROBLEM, REMOVE VARIABLE NAMES & PUT THEM (PROTOTYPES) HERE:
// Return the Circumference of Circle
double CCircle(double);
// Return the Area of Circle
double ACircle(double);
// Return the Surface Area of Sphere
double SASphere(double);
int main ()
{
// Test 1:
double radius = 1;
double circumference = CCircle(radius);
double circle_area = ACircle(radius);
cout << setw(2) << "Radius = " << radius << " CCircle = " << setw(10) << circumference << endl;
// Another way
cout << setw(2) << "Radius = " << radius << " CCircle = " << setw(10) << CCircle(radius) << endl;
// Yet another way
cout << setw(2) << "Radius = 1 CCircle = " << setw(10) << CCircle(1) << endl;
//Test 2
cout << setw(2) << "Area = " << radius << " ACircle = " << setw(10) << circle_area << endl;
return 0;
}
//FUNCTION IMPLEMENTATIONS GO HERE AFTER MAIN
//USE COPY AND PASTE AS A START
// Return the Circumference of Circle
double CCircle(double aRadius)
{
return 2 * PI * aRadius;
}
// Return the Area of Circle
double ACircle(double aRadius)
{
double area = PI * aRadius * aRadius;
return area;
}
double SASphere(double aRadius)
{
double area = 0;
area = 4 * PI * aRadius * aRadius;
return area;
}