Compile Error

/in/foo.cc:2:11: error: 'double y1' redeclared as different kind of entity
    2 | double x1,y1,x2,y2,distance;
      |           ^~
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:5:21: warning: format '%lf' expects argument of type 'double*', but argument 3 has type 'double (*)(double) noexcept' {aka 'double (*)(double)'} [-Wformat=]
    5 |         scanf("%lf%lf%lf%lf", &x1,&y1,&x2,&y2);
      |                   ~~^             ~~~
      |                     |             |
      |                     double*       double (*)(double) noexcept {aka double (*)(double)}
/in/foo.cc:6:45: error: invalid operands of types 'double(double) noexcept' {aka 'double(double)'} and 'double' to binary 'operator-'
    6 |         distance = sqrt( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) );
      |                                           ~~^~~
      |                                           |  |
      |                                           |  double
      |                                           double(double) noexcept {aka double(double)}
/in/foo.cc:6:53: error: invalid operands of types 'double(double) noexcept' {aka 'double(double)'} and 'double' to binary 'operator-'
    6 |         distance = sqrt( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) );
      |                                                   ~~^~~
      |                                                   |  |
      |                                                   |  double
      |                                                   double(double) noexcept {aka double(double)}

信息

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