C语言:请帮我看一下求(x,y)到原点之间的距离d的代码有什么错误

来源:百度知道 编辑:UC知道 时间:2024/09/23 12:33:02
#include<stdio.h>
main()
{ int x=0,y=0;
double d=0;
printf("please enter x and y);
scanf("%d%d",&x,&y);
d=(double)squirt(x*x+y*y)
printf("d=%lf\n",d);
}
我输入X和Y后结果是0.000000,不知是什么原因,哪位高手起脚一下,不要整复杂了,我非常感谢!

#include<stdio.h>
#include<math.h>//开方函数sqrt是math库里的
main()
{ double x, y;
double d;
x = 0.0;
y = 0.0;
printf("please enter x and y\n");// 引号要匹配,还有最好加个换//行符\n
scanf("%lf%lf",&x,&y);
d = sqrt(x*x+y*y); //语句结束要加分号 开方函数名是sqrt
printf("d = %lf\n",d);
}

#include<stdio.h>
main()
{ int x=0,y=0;
double d=0;
printf("please enter x and y");//引号
scanf("%d,%d",&x,&y); //输入要这样 避免输入7和8 把78输入到x里而y还是0
d=sqrt(x*x+y*y);//分号 squirt是什么?
printf("d=%lf\n",d);
}

d=(double)squirt(x*x+y*y)
这里~整形开方还是整形~转成double不过是多+几个0而已。把X和Y也弄成double吧。

d=(double)squirt(x*x+y*y)

这里好像么有;
而且好象不是squirt,是squrt

#include<stdio.h>
main()
{ int x=0,y=0;
long d=0;
printf("please enter x and y);