#include <iostream>
usingnamespace std;
int main()
{
cout << "Katie Stevers" << endl;
cout << "Program 2" << endl;
cout << "September 11, 2016" << endl;
cout << "\t\t" << endl;
cout << "\t\t" << endl;
int pi = 3.141592653589793238462643383279502884197169399375;
cout << "Please input the value of the radius: " << endl;
cin >> radius;
cout << "Please input the value of the height: " << endl;
cin >> height;
int circumference = 2 * pi * radius;
int surface area = (2 * pi * (radius * radius)) + (2 * pi * radius * height);
int volume = pi * (radius * radius) * height;
cout << "The circumference of the cylinder is " << circumference << "." << endl;
cout << "The surface area of the cylinder is " << surface area << "." << endl;
cout << "The volume of the circle is " << volume << "." << endl;
}
#include <iostream>
#include <iomanip>
#include <fstream>
usingnamespace std;
int main()
{
cout << "Katie Stevers" << endl;
cout << "Program 2" << endl;
cout << "September 11, 2016" << endl;
cout << "\t\t" << endl;
cout << "\t\t" << endl;
int pi = 3.141592653589793238462643383279502884197169399375;
cout << "Please input the value of the radius: " << endl;
cin >> radius;
cout << "Please input the value of the height: " << endl;
cin >> height;
int circumference = 2 * pi * radius;
int surfacearea = (2 * pi * (radius * radius)) + (2 * pi * radius * height);
int volume = pi * (radius * radius) * height;
cout << "The circumference of the cylinder is " << circumference << "." << endl;
cout << "The surface area of the cylinder is " << surfacearea << "." << endl;
cout << "The volume of the circle is " << volume << "." << endl;
}
Hi kns2872.
One of the most common mistakes that programmers do, is forgetting to define the variables.
I mean for example
1 2 3 4 5 6
int age;
float height;
double pi;
.
.
.
===============================================================
The answer of your problem:
you must declare variables before using them.
In line 14,19,20,21: Replace int with double
if you use int for declaring variables witch have decimal part, the decimal part will be deleted entirely.
add this code to your program(its better to add between lines 8 and 9) double height, radius;