解题思路:
注意事项:
参考代码:
#include<stdio.h>
struct date
{
int year;
int month;
int day;
};
int main()
{
struct date today;
scanf("%d %d %d",&today.year,&today.month,&today.day);
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int sum=0;
if(today.year%4==0&&today.year%100!=0||today.year%400==0)
a[1]=29;
for(int i=0;i<today.month-1;i++)
{
sum+=a[i];
}
sum+=today.day;
printf("%d",sum);
return 0;
}
0.0分
0 人评分