Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This program attempts to calculate the volume and surface area of a cylinder when given height and radius.
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int height;
- int radius;
- int Volume;
- int Surface_Area;
- cout << fixed << showpoint << setprecision(2);
- cout << "Enter the height and radius: ";
- cin >> height >> radius;
- cout << endl;
- cout << "The height is " << height
- << ", and the radius is " << radius
- << "." << endl;
- Volume = 3.14 * radius * radius * height;
- Surface_Area = (2 * 3.14 * radius * height) + (2 * 3.14 * radius * radius);
- cout << "The volume and surface area of the cylinder are " << Volume
- << " and " << Surface_Area
- << ", respectively." << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment