有关圈圈的计算

#include<math.h>   
#include<iostream>   
using namespace std;  
#define PI 3.1415926   
int main()  
{  
    int r,h,s,l,sq,vq,sz,vz,sy,vy;  
    cout<<"请输入半径和高r,h:";  
    cin>>r>>h;  
    s=r*r*PI;  
    l=2*r*PI;  
    sq=4*PI*r*r;  
    vq=3.0/4.0*PI*r*r*r;  
    sz=r*r*PI*h;  
    vz=r*r*h;  
    sy=PI*r*r+PI*r*sqrt(h*h+r*r);  
    vy=3.0/1.0*PI*r*r*h;  
    cout<<"圆的面积="<<s<<endl;  
    cout<<"圆的周长="<<l<<endl;  
    cout<<"球的表面积="<<sq<<endl;  
    cout<<"球的体积="<<vq<<endl;  
    cout<<"圆柱的表面积="<<sz<<endl;  
    cout<<"圆柱的体积="<<vz<<endl;  
    cout<<"圆锥的表面积="<<sy<<endl;  
    cout<<"圆锥的体积="<<vy<<endl;  
    return 0;  
} 

运行结果:

有关圈圈的计算_第1张图片

你可能感兴趣的:(有关圈圈的计算)