Compile Error
/in/foo.c:3:2: error: invalid preprocessing directive #inlucde #inlucde<math.h> ^~~~~~~ /in/foo.c: In function 'process': /in/foo.c:9:1: error: 'sun' undeclared (first use in this function) sun=0; ^~~ /in/foo.c:9:1: note: each undeclared identifier is reported only once for each function it appears in /in/foo.c:18:1: error: 'sum' undeclared (first use in this function) sum=sum+day; ^~~ /in/foo.c:22:1: error: expected ';' before '}' token } ^ /in/foo.c:8:5: warning: unused variable 'ans' [-Wunused-variable] int ans,i; ^~~ /in/foo.c:24:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
代码
#include<stdio.h>
#include<string.h>
#inlucde<math.h>
int process(int year, int month,int day)
{
int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int flag;
int ans,i;
sun=0;
if(year%400==0||(year%4==0&&year%100!=0))
flag=1;
else
flag=0;
for(i=0;i<month-1;i++)
{
sun=sun+mon[i];
}
sum=sum+day;
if(flag&&month>2)
{
sun++
}
return sun;
}
int main(int argc,char*argv[])
{
int year,month,day,sum;
scanf("%d%d%d",&year,&month,&day);
sum=process(year,month,day);
printf("%d",sum);
return 0;
}
信息
- 递交者
- 类型
- 递交
- 题目
- 给出年、月、日,计算该日是该年的第几天
- 题目数据
- 下载
- 语言
- C
- 递交时间
- 2018-06-20 22:35:34
- 评测时间
- 2018-06-20 22:35:34
- 评测机
- 分数
- 0
- 总耗时
- 0ms
- 峰值内存
- 0 Bytes