球球大佬帮着看看为什么会编译失败

P5735 【深基7.例1】距离函数

xhxxhx @ 2021-05-23 21:53:50


#include <bits/stdc++.h> 
using namespace std;

double dis(double x1,double x2,double y1,double y2)
{

    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main()
{
    double x1,x2,x3,y1,y2,y3,c;
    cin>>x1>>x2>>x3>>y1>>y2>>y3;
    double dis1=dis(x1,x2,y1,y2),dis2=dis(x2,x3,y2,y3),dis3=dis(x1,x3,y1,y3);
    c = dis1 + dis2 + dis3;
    sprintf("%.2f",c)
    return 0;
}
```cpp

by _caiji_ @ 2021-05-23 21:57:22

    sprintf("%.2f",c)
//  ^~~~~~~

为什么要用 sprintf


by Orange_qwq @ 2021-05-23 21:57:51

dis3=dis(x1,x3,y1,y3)

by _Sparkle @ 2021-05-23 22:02:36

y1撞了


|