这是我做
1005题的代码,希望大家看完之后能给予指导。
1
#include <stdio.h>
2
3
#define PI 3.141592
4
5
int Caculate(float x, float y)
6

{
7
int r = (int)((x*x + y*y) * PI / 100);
8
return r*100 >= (x*x + y*y)*PI ? r : r+1;
9
}
10
11
int main(int argc, char* argv[])
12

{
13
int n, i;
14
float x,y;
15
int year;
16
scanf("%d", &n);
17
for(i = 1; i <= n; i++)
18
{
19
scanf("%f %f", &x, &y);
20
year = Caculate(x, y);
21
printf("Property %d: This property will begin eroding in year %d.\n", i, year);
22
}
23
printf("END OF OUTPUT.\n");
24
25
return 0;
26
}
27
28