Compile Error

foo.cc:1:2: error: stray '#' in program
    1 | v#include <iostream>
      |  ^
foo.cc:1:1: error: 'v' does not name a type
    1 | v#include <iostream>
      | ^
foo.cc: In function 'int main()':
foo.cc:8:8: error: conflicting declaration 'float sum'
    8 |  float sum=0;
      |        ^~~
foo.cc:7:10: note: previous declaration as 'int sum'
    7 |  int i,n,sum=0,fz,fm,t;
      |          ^~~
foo.cc:9:2: error: 'cin' was not declared in this scope
    9 |  cin>>n;
      |  ^~~
foo.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    2 | #include <cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
foo.cc:19:13: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
   19 |  printf("%.2f",sum)
      |          ~~~^  ~~~
      |             |  |
      |             |  int
      |             double
      |          %.2d
foo.cc:19:20: error: expected ';' before '}' token
   19 |  printf("%.2f",sum)
      |                    ^
      |                    ;
   20 | }
      | ~                   
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1054 数列求和
语言
C++
递交时间
2022-01-26 10:51:09
评测时间
2022-01-26 10:51:09
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes