记录详情

Compile Error

foo.c: In function 'main':
foo.c:5:11: error: conflicting types for 'a'
    5 |    double a, b, sum;
      |           ^
foo.c:4:10: note: previous declaration of 'a' was here
    4 |   int n, a,b;
      |          ^
foo.c:5:14: error: conflicting types for 'b'
    5 |    double a, b, sum;
      |              ^
foo.c:4:12: note: previous declaration of 'b' was here
    4 |   int n, a,b;
      |            ^
foo.c:6:3: warning: statement with no effect [-Wunused-value]
    6 |   sum 0;
      |   ^~~
foo.c:6:6: error: expected ';' before numeric constant
    6 |   sum 0;
      |      ^~
      |      ;
foo.c:9:9: error: expected ';' before ':' token
    9 |  for(b=0:b<n;b++);
      |         ^
      |         ;
foo.c:9:17: error: expected ';' before ')' token
    9 |  for(b=0:b<n;b++);
      |                 ^
      |                 ;
foo.c:10:11: warning: unknown conversion type character ' ' in format [-Wformat=]
   10 |   scanf("% %1f", &a, &b);
      |           ^
foo.c:10:14: warning: format '%f' expects argument of type 'float *', but argument 2 has type 'double *' [-Wformat=]
   10 |   scanf("% %1f", &a, &b);
      |            ~~^   ~~
      |              |   |
      |              |   double *
      |              float *
      |            %1lf
foo.c:10:9: warning: too many arguments for format [-Wformat-extra-args]
   10 |   scanf("% %1f", &a, &b);
      |         ^~~~~~~
foo.c:11:7: warning: statement with no effect [-Wunused-value]
   11 |   sum + a/b;
      |   ~~~~^~~~~
foo.c:13:10: error: 'O' undeclared (first use in this function)
   13 |   return O;
      |          ^
foo.c:13:10: note: each undeclared identifier is reported only once for each function it appears in
foo.c:7:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
    7 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
foo.c:10:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   10 |   scanf("% %1f", &a, &b);
      |   ^~~~~~~~~~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
A6-3 最大公约数专题:多个分数的加法
比赛
中北 计算机2021级专业修读指导(3)
语言
C
递交时间
2021-12-16 23:56:31
评测时间
2021-12-16 23:56:31
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes