请大家修改一个程序!
这个程序是输入年,月,日,求它是在本年中的第几天!我是这样写的:
#include<stdio.h>
void main()
{ struct date
{ int month;
int day;
int year;
}Day;
int number;
int days(struct date);
scanf("%d,%d,%d",&Day.month,&Day.day,&Day.year);
printf("\n");
number=days(Day);
printf("This day is the No.%d day in this year\n",number);
}
int days(struct date Day)
{ int number;
switch(month)
{
case1:number=day;break;
case2:number=day+31;break;
case3:number=day+59;break;
case4:number=day+90;break;
case5:number=day+120;break;
case6:number=day+151;break;
case7:number=day+181;break;
case8:number=day+212;break;
case9:number=day+243;break;
case10:number=day+273;break;
case11:number=day+304;break;
case12:number=day+334;break;
}
if(((year%4==0&&year%100!=0)||year%400==0)&&month>2)
number=number+1;
return number;
}
不知道我错在哪儿了