Compile Error

foo.cc: In function ‘bool leap(int)’:
foo.cc:7:18: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    7 |         if(x%4==0&&x%100!=0||x%400==0) return true;
      |            ~~~~~~^~~~~~~~~~
foo.cc: In function ‘int monthday(int, int)’:
foo.cc:12:44: error: ‘d’ was not declared in this scope
   12 |         if(m==4||m==6||m==8||m==10||m==12) d=30;
      |                                            ^
foo.cc:13:23: error: ‘d’ was not declared in this scope
   13 |         else if(m==2) d=28+leap(x);
      |                       ^
foo.cc:13:33: error: ‘x’ was not declared in this scope
   13 |         else if(m==2) d=28+leap(x);
      |                                 ^
foo.cc:14:14: error: ‘d’ was not declared in this scope
   14 |         else d=31;
      |              ^
foo.cc:15:16: error: ‘f’ was not declared in this scope
   15 |         return f;
      |                ^
foo.cc: At global scope:
foo.cc:17:19: error: ‘m’ has not been declared
   17 | int yearday(int y,m,d)
      |                   ^
foo.cc:17:21: error: ‘d’ has not been declared
   17 | int yearday(int y,m,d)
      |                     ^
foo.cc: In function ‘int yearday(int, int, int)’:
foo.cc:19:17: error: ‘d’ was not declared in this scope
   19 |         int ret=d;
      |                 ^
foo.cc:20:23: error: ‘m’ was not declared in this scope
   20 |         for(int i=1;i<m;i++)
      |                       ^
foo.cc:21:35: error: expected ‘;’ before ‘return’
   21 |                 ret+=monthday(y,i)
      |                                   ^
      |                                   ;
   22 |         return ret;
      |         ~~~~~~                     
foo.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^

信息

递交者
类型
递交
题目
P1093 5-6 过去了多少天
语言
C++
递交时间
2025-07-20 09:01:02
评测时间
2025-07-20 09:01:02
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes