zhanwang @ 2023-09-06 19:40:36
dev里面编译显示一直错
#include<bits/stdc++.h>
using namespace std;
int x1,y1,x2,x3,y2,y3;
int main(){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
double sum=0;
sum+=sqrt(pow((max(x1,x2)-min(x1,x2),2))+pow((max(y1,y2)-min(y1,y2),2)));
sum+=sqrt(pow((max(x2,x3)-min(x2,x3),2))+pow((max(y2,y3)-min(y2,y3),2)));
sum+=sqrt(pow((max(x1,x3)-min(x1,x3),2))+pow((max(y1,y3)-min(y1,y3),2)));
cout<<fixed<<setprecision(3)<<(double)sum;
return 0;
}
有没有大佬帮忙解答一下[鞠躬]
by Pitiless_boy @ 2023-09-06 19:41:36
@zhanwang 函数名重复
by xuchuhan @ 2023-09-06 19:41:43
变量名
by bzzltl @ 2023-09-06 19:42:12
@zhanwang 括号匹配有问题
#include<bits/stdc++.h>
using namespace std;
int x1,y1,x2,x3,y2,y3;
int main(){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
double sum=0;
sum+=sqrt(pow((max(x1,x2)-min(x1,x2)),2)+pow((max(y1,y2)-min(y1,y2)),2));
sum+=sqrt(pow((max(x2,x3)-min(x2,x3)),2)+pow((max(y2,y3)-min(y2,y3)),2));
sum+=sqrt(pow((max(x1,x3)-min(x1,x3)),2)+pow((max(y1,y3)-min(y1,y3)),2));
cout<<fixed<<setprecision(3)<<(double)sum;
return 0;
}
by bzzltl @ 2023-09-06 19:42:58
以及万能头下不要用y1
做变量名
by xuchuhan @ 2023-09-06 19:43:46
建议更换变量名。
@zhanwang
by zhanwang @ 2023-09-06 19:47:53
@bzzltl @xuchuhan @Pitiless_boy 谢谢大佬,把y1改了之后就能编译了
by bzzltl @ 2023-09-06 19:50:37
@zhanwang 函数名没有重复,那个人说的有问题
by zhanwang @ 2023-09-06 19:53:31
@bzzltl 嗯嗯
by _8008008 @ 2023-09-06 20:18:59
@bzzltl 有函数用这个作为函数名的吗iostream+手写函数的表示很懵逼
by bzzltl @ 2023-09-06 20:19:52
@_8008008 你指的哪一个?