Compile Error

foo.cc: In function 'int main()':
foo.cc:20:25: warning: statement has no effect [-Wunused-value]
   20 |                     for(i;i<=n1;i++)
      |                         ^
foo.cc:21:40: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   21 |                     if(i%400==0||i%4==0&&i%100!=0) s++;
      |                                  ~~~~~~^~~~~~~~~~
foo.cc: At global scope:
foo.cc:31:11: error: redefinition of 'long long int n'
   31 | long long n,s=0,n1,i;
      |           ^
foo.cc:3:11: note: 'long long int n' previously declared here
    3 | long long n,s=0,n1,i;
      |           ^
foo.cc:31:13: error: redefinition of 'long long int s'
   31 | long long n,s=0,n1,i;
      |             ^
foo.cc:3:13: note: 'long long int s' previously defined here
    3 | long long n,s=0,n1,i;
      |             ^
foo.cc:31:17: error: redefinition of 'long long int n1'
   31 | long long n,s=0,n1,i;
      |                 ^~
foo.cc:3:17: note: 'long long int n1' previously declared here
    3 | long long n,s=0,n1,i;
      |                 ^~
foo.cc:31:20: error: redefinition of 'long long int i'
   31 | long long n,s=0,n1,i;
      |                    ^
foo.cc:3:20: note: 'long long int i' previously declared here
    3 | long long n,s=0,n1,i;
      |                    ^
foo.cc:32:5: error: redefinition of 'int main()'
   32 | int main()
      |     ^~~~
foo.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
foo.cc: In function 'int main()':
foo.cc:48:25: warning: statement has no effect [-Wunused-value]
   48 |                     for(i;i<=n1;i++)
      |                         ^
foo.cc:49:40: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   49 |                     if(i%400==0||i%4==0&&i%100!=0) s++;
      |                                  ~~~~~~^~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1625 闰年祝福
语言
C++
递交时间
2023-07-24 09:55:58
评测时间
2023-07-24 09:55:58
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes