四舍五入的技巧
#include <iostream>
using namespace std;
const double PI = 3.1415926;
int main()
{
float r;
while(cin >> r)
{
cout << int(4*PI*r*r*r/3 +0.5) << endl;
}
return 0;
}
时间: 2024-10-13 23:26:53
四舍五入的技巧
#include <iostream>
using namespace std;
const double PI = 3.1415926;
int main()
{
float r;
while(cin >> r)
{
cout << int(4*PI*r*r*r/3 +0.5) << endl;
}
return 0;
}