Compile Error
/in/foo.c: In function 'main': /in/foo.c:10:12: error: 'm' undeclared (first use in this function) for(i=0;i<m-1;i++) ^ /in/foo.c:10:12: note: each undeclared identifier is reported only once for each function it appears in /in/foo.c:14:11: error: 'd' undeclared (first use in this function) sum=sum+d; ^ /in/foo.c:17:3: error: expected declaration or statement at end of input return 0; ^~~~~~
代码
#include<stdio.h>
int main()
{
int year,month,day;
scanf("%d,%d,%d",&year,&month,&day);
int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int f,sum=0,i;
if(year%400==0||(year%4==0&&year%100!=0)) f=1;
else f=0;
for(i=0;i<m-1;i++)
{
sum=sum+mon[i];
}
sum=sum+d;
if(f&&m>2) sum++;
printf(" %dth",sum);
return 0;
信息
- 递交者
- 类型
- 递交
- 题目
- 给出年、月、日,计算该日是该年的第几天
- 题目数据
- 下载
- 语言
- C
- 递交时间
- 2018-06-20 23:16:23
- 评测时间
- 2018-06-20 23:16:23
- 评测机
- 分数
- 0
- 总耗时
- 0ms
- 峰值内存
- 0 Bytes