Compile Error

foo.cc: In function ‘int main()’:
foo.cc:7:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    7 |         for(y%4==0&&y%100!=0||y%400==0)
      |             ~~~~~~^~~~~~~~~~
foo.cc:7:39: error: expected ‘;’ before ‘)’ token
    7 |         for(y%4==0&&y%100!=0||y%400==0)
      |                                       ^
      |                                       ;
foo.cc:7:29: warning: statement has no effect [-Wunused-value]
    7 |         for(y%4==0&&y%100!=0||y%400==0)
      |             ~~~~~~~~~~~~~~~~^~~~~~~~~~
foo.cc:9:9: error: expected primary-expression before ‘switch’
    9 |         switch(m)
      |         ^~~~~~
foo.cc:8:24: error: expected ‘;’ before ‘switch’
    8 |                 leap=1;
      |                        ^
      |                        ;
    9 |         switch(m)
      |         ~~~~~~          
foo.cc:9:9: error: expected primary-expression before ‘switch’
    9 |         switch(m)
      |         ^~~~~~
foo.cc:8:24: error: expected ‘)’ before ‘switch’
    8 |                 leap=1;
      |                        ^
      |                        )
    9 |         switch(m)
      |         ~~~~~~          
foo.cc:7:12: note: to match this ‘(’
    7 |         for(y%4==0&&y%100!=0||y%400==0)
      |            ^

信息

递交者
类型
递交
题目
P1627 A1-3 分支结构练习:月份天数
语言
C++
递交时间
2025-08-25 10:12:11
评测时间
2025-08-25 10:12:11
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes