求球的体积

输入半径,输出体积。
#include
double PI = 3.1415927;
using namespace std;
int main()
{
int number;
cout << "numeber of balls = ";
cin >> number;
float *a = new float [number];
cout << “input radius” << endl;
for (int i = 0; i < number; i++)
{
cin >> a[i];
}
cout << “corresponding volume :” << endl;
for (int i = 0; i < number; i++)
{
float V = (PI * 4.0 * a[i] * a[i] * a[i]) / 3.0;
cout << V << endl;
}
}

猜你喜欢

转载自blog.csdn.net/weixin_44014654/article/details/84887561