Compile Error

/in/foo.cc:3:11: error: 'double y1' redeclared as different kind of entity
    3 | double x1,y1,x2,y2,sum;
      |           ^~
In file included from /usr/include/features.h:489,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/c++config.h:655,
                 from /usr/include/c++/12/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:33,
                 from /in/foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:224:1: note: previous declaration 'double y1(double)'
  224 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:6:17: warning: format '%lf' expects argument of type 'double*', but argument 3 has type 'double (*)(double) noexcept' {aka 'double (*)(double)'} [-Wformat=]
    6 |     scanf("%lf%lf%lf%lf", &x1,&y1,&x2,&y2);
      |               ~~^             ~~~
      |                 |             |
      |                 double*       double (*)(double) noexcept {aka double (*)(double)}
/in/foo.cc:7:33: error: invalid operands of types 'double(double) noexcept' {aka 'double(double)'} and 'double' to binary 'operator-'
    7 |     sum=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
      |                               ~~^~~
      |                               |  |
      |                               |  double
      |                               double(double) noexcept {aka double(double)}
/in/foo.cc:7:41: error: invalid operands of types 'double(double) noexcept' {aka 'double(double)'} and 'double' to binary 'operator-'
    7 |     sum=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
      |                                       ~~^~~
      |                                       |  |
      |                                       |  double
      |                                       double(double) noexcept {aka double(double)}

信息

递交者
类型
递交
题目
P1647 距离
语言
C++
递交时间
2025-02-16 13:15:20
评测时间
2025-02-16 13:15:20
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes