Abel9210

test

Mar 15th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. //This program attempts to calculate the volume and surface area of a cylinder when given height and radius.
  2.  
  3. #include <iostream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int height;
  11.     int radius;
  12.     int Volume;            
  13.     int Surface_Area;      
  14.  
  15.     cout << fixed << showpoint << setprecision(2);
  16.  
  17.     cout << "Enter the height and radius: ";
  18.     cin >> height >> radius;
  19.     cout << endl;
  20.  
  21.     cout << "The height is " << height
  22.         << ", and the radius is " << radius
  23.         << "." << endl;
  24.     Volume = 3.14 * radius * radius * height;
  25.     Surface_Area = (2 * 3.14 * radius * height) + (2 * 3.14 * radius * radius);
  26.     cout << "The volume and surface area of the cylinder are " << Volume
  27.         << " and " << Surface_Area
  28.         << ", respectively." << endl;
  29.  
  30.     system("pause");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment