who_scat @ 2024-12-08 20:11:00
c语音,代码如下
#include<stdio.h>
#include<math.h>
int lengther(double a,double b,double c,double d)
{
return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}
int main()
{
double a,b,c,d,e,f,sum=0;
scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);
sum=lengther(a,b,c,d)+lengther(a,b,e,f)+lengther(c,d,e,f);
printf("%.2lf",sum);
return 0;
}
大佬们帮忙看看
by KarmaticEnding @ 2024-12-08 20:12:34
@who_scat
srds有没有一种可能你的 lengther
返回的是 int
啊
by 清清老大 @ 2024-12-08 20:21:35
建议开编译警告。 -Wconversion
就能查到这一个