C语言 看 下 这个程序 麻烦改正下

来源:百度知道 编辑:UC知道 时间:2024/05/09 19:35:13
#include<stdio.h> #include<math.h>
void main()
{
float x,y,r,t;
scanf("%f,%f",x,y);
r=(x-2)^2+(y-2)^2);
t=double sqrt(double r);
if(t<=2)printf("the hight is 2M\n");
else printf("the hight is 0M\n");
}
提示说x,y,t没定义 但是 我定义了啊

修改好了,有不少小错误,现在没问题了

#include<stdio.h>
#include<math.h>

void main()
{
float x, y, r, t;

scanf( "%f%f", &x, &y );
r = ( x - 2 )*( x - 2 ) + ( y - 2 )*( y - 2 );
t = (float) sqrt( r );

if ( t <= 2 )
printf( "the hight is 2M\n" );
else
printf( "the hight is 0M\n" );

}

scanf("%f,%f",x,y);
改为:scanf("%f,%f",&x,&y);

r=(x-2)^2+(y-2)^2); 改为:r=(x-2)*(x-2)+(y-2)*(y-2);

scanf("%f,%f",x,y);
改为:scanf("%f,%f",&x,&y);
r=(x-2)^2+(y-2)^2); 多了个括号

scanf("%f,%f",&x,&y);
r=(x-2)^2+(y-2)^2

#include<stdio.h>
#include<math.h>
void main()
{
float x,y,r,t;
scanf("%f,%f",x,y); //改为:scanf("%f,%f",x,y);
r=(x-2)^2+(y-2)^2); //多了')'
t=double sqrt(doubl