when i want to ask anyone,i will ask myself first.
大家赶紧帮下忙
我基本做出来了 思路没问题 但是根号总是算不出来 数据溢出
我给你改改吧
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float x,y,m=0.000001,r[4],h=0;
int i;
printf("please input(x,y):\n");
scanf("%f%f",&x,&y);
r[0]=(x-2)*(x-2)+(y-2)*(y-2);
r[1]=(x-2)*(x-2)+(y+2)*(y+2);
r[2]=(x+2)*(x+2)+(y-2)*(y-2);
r[3]=(x+2)*(x+2)+(y+2)*(y+2);
for(i=0;i<4;i++)
if(r[i]-1<=m)
h=10-sqrt(r[i])*10;
printf("%f\n",h);
getch();
}