圆柱体的面积分为三个部分,侧面积,上,下面积组成。由于上下面积一样。故圆柱体的面积=底面积x2+侧面积S=2*π*r*r+2*π*r*h;
#include "stdafx.h"
#include "math.h"
#include "iostream"
using namespace std;
int main(int argc,int *argc[])
{
const double PI=acos(-1.0);//3.141519
double S, s1 , s2;
double H,R;
cout <<"Please input Cylinder R,H:"
cin >> R;
cin >>H;
s1=2 * PI *R*R;
s2=2*PI*R*H;
S=s1+s2;
count <<"Cylinder area is:"<<S<<endl;
return 0;
}
#include "stdafx.h"
#include "math.h"
#include "iostream"
using namespace std;
int main(int argc,int *argc[])
{
}