xiao13030502629 @ 2024-08-16 21:50:52
#include <stdio.h>
#include <math.h>
int distance(double x1, double x2, double y1, double y2) {
double m = 0;
m = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
double add = 0;
add = sqrt(m);
return add;
}
int main() {
double a1, a2, b1, b2, c1, c2;
scanf("%lf %lf", &a1, &a2);
scanf("%lf %lf", &b1, &b2);
scanf("%lf %lf", &c1, &c2);
double m, n, j;
m = distance(a1, a2, b1, b2);
n = distance(a1, a2, c1, c2);
j = distance(b1, b2, c1, c2);
printf("%.2f", m + n + j);
return 0;
}
by dongzirui0817 @ 2024-08-16 22:10:19
@xiao13030502629 注意distance
函数的返回值
by xiao13030502629 @ 2024-08-17 20:01:22
@dongzirui0817 这个函数的返回值是有什么问题吗
by xiao13030502629 @ 2024-08-17 20:13:24
@dongzirui0817 ok知道哪里有问题了,多谢了