计算球的体积

#include <iostream>
#define PI 3.1415927
#include<iomanip>
using namespace std;
class ball{
public:
double setV(double R)
{
double V=4.0/3*PI*R*R*R;
return V;
}
public:
double R;
};
int main()
{
ball a;
double R,V;
cin>>R;
cout<<fixed<<setprecision(3);
cout<<a.setV(R)<<endl;
}

posted @ 2020-02-16 13:51  heroin1  阅读(156)  评论(0)    收藏  举报