四舍五入的技巧
#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-12-28 09:46:16
四舍五入的技巧
#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;
}