解题思路: 不知道为什么使用typedef答案就是错误,搞不懂,求大神解答。
注意事项:
参考代码:
#include<stdio.h>
struct date{
int year;
int month;
int day;
};
int main(){
struct date temp;
int sum=0;
int month_num[12]={31,28,31,30,31,30,31,31,30,31,30,31};
scanf("%d%d%d",&temp.year,&temp.month,&temp.day);
if((temp.year%4==0&&temp.year%100!=0)||(temp.year%400==0))
month_num[1]=29;
for(int i=0;i<temp.month-1;i++)
sum+=month_num[i];
sum+=temp.day;
printf("%d",sum);
return 0;
}
0.0分
0 人评分