#include<stdio.h>
struct date
{
int year;
int month;
int day;
}days;
main()
{
struct date days;
int d=0,i;
printf("输入年月日");
scanf("%d%d%d",&days.year,&days.month,&days.day);
if(days.month==1)
d+=days.day;
else for(i=1;i<days.month;i++)
{
switch(i)
{
case 1:case 3:case 5:case 7:case 8:case 10:d+=31;break;
case 4:case 6:case 9:case 11:d+=30;break;
}
if(i==2)
{
if(days.year%400==0 || days.year%100!=0 && days.year%4==0)
d+=29;
else
d+=28;
}
d+=days.day;
}
printf("%d",d);
}
不知哪里出问题了 算12月31号就会有600多天