Start here:
#include <iostream> using namespace std; double circle_area(double radius) { const double PI = atan(1.0) * 4; double area; area = PI*radius*radius; return area; } int main() { double radius; cout << "I would like to compute the area of a circle for you.\n\n"; cout << "Please give the radius of the desired cylinder: "; cin >> radius; cout << "The area is " << circle_area(radius) << endl << endl; system("pause"); return 0; }
End here:
#include <iostream> using namespace std; double circle_area(double radius) { const double PI = atan(1.0) * 4; double area; area = PI*radius*radius; return area; } double cylinder_volume(double radius, double height) { double volume; volume = height * circle_area(radius); return volume; } int main() { double radius, height; cout << "I would like to compute the volume of a cylinder for you.\n\n"; cout << "Please give the radius of the desired cylinder: "; cin >> radius; cout << "Please give the height of the desired cylinder: "; cin >> height; cout << "The volume is " << cylinder_volume(radius, height) << endl << endl; system("pause"); return 0; }Back to top