1.刚开始想成是整个圆了,所以一直出错;
2.ceil()函数,第一次用,详见(ceil_百度百科)
#include <cmath> #include <iostream> using namespace std; const double PI = 3.1415926; int main() { double x, y, n; cin >> n; for(int i = 1; i <= n; i++) { cin >> x >> y; cout << "Property " << i << ": This property will begin eroding in year " << ceil(PI * (x * x + y * y) / 100) << '.' << endl; } cout << "END OF OUTPUT." << endl; }