#include <iostream>
#include <string>
usingnamespace std;
float pi = 3.1415926;
void main () {
// input variables
float radius;
// processing variables
float diameter,
circumference,
area;
// input section
cout << "This program will take the radius of the circle that you enter and give you the diameter, circumference, and area of the circle." << endl << endl;
cout << "Please enter the radius of the circle: ";
cin >> radius;
// processing section
diameter = radius + radius;
area = radius * radius * pi;
circumference = pi * diameter ;
// output section
cout << "The diameter of the circle is : " << diameter << endl << endl;
cout << "The area of the circle is : " << area << endl << endl;
cout << "The circumference of the circle is : " << circumference << endl;
system ("pause");
}
I guess I should have been more specific i need it to preform the calculation and then display the answer. I do not need to show the formula itself. Sorry for the confusion.
#include <iostream>
#include <string>
usingnamespace std;
float pi = 3.1415926;
void main () {
// input variables
float radius;
// processing variables
float diameter,
circumference,
area;
// input section
cout << "This program will take the radius of the circle that you enter and give you the diameter, circumference, and area of the circle." << endl << endl;
cout << "Please enter the radius of the circle: ";
cin >> radius;
// output section
cout << "The diameter of the circle is : " << radius + radius << endl << endl;
cout << "The area of the circle is : " << radius * radius * pi << endl << endl;
cout << "The circumference of the circle is : " << pi * ( radius + radius ) << endl;
system ("pause");
}