Answer to Question #23079 in C++ for felix chimezie oguamanam

Question #23079
Write a program to calculate the surface area and volume of a cylinder using a macro
surface_area = 2 * Pi * r * (r + h)
Volume = Pi * r * r * h
1
Expert's answer
2013-01-29T11:11:19-0500
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
cout << "enter r and h" << endl;
double r;
cin>>r;
cout<<endl;
double h;
cin>>h;
double Pi=3.14;

double surface_area = 2*Pi*r*(r+h);
double Volume = Pi*r*r*h;

cout<<"surface_area= "<<surface_area<<endl;
cout<<"Volume= "<<Volume<<endl;

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS