解题思路:
注意事项:
参考代码:
#include<stdio.h> int month_day[2][13]={{0,31,29,31,30,31,30,31,31,30,31,30,31},{0,31,28,31,30,31,30,31,31,30,31,30,31}}; struct day { int year; int month; int day; int flag; }; int to_day(struct day days); int main(void) { int year; int month; int day; struct day days; scanf("%d%d%d",&days.year,&days.month,&days.day); if((days.year%400==0)||(days.year%4==0 && days.year%100!=0)) days.flag=0; else days.flag=1; printf("%d",to_day(days)); return 0; } int to_day(struct day days) { int sum=0; for(int j=1;j<=days.month-1;j++) sum+=month_day[days.flag][j]; return sum+days.day; }
0.0分
1 人评分
C语言训练-角谷猜想 (C++代码)(3N+1问题)浏览:1835 |
Tom数 (C++代码)浏览:861 |
十->二进制转换 (C语言代码)浏览:1323 |
用筛法求之N内的素数。 (C语言代码)浏览:679 |
完数 (C语言代码)浏览:738 |
C语言程序设计教程(第三版)课后习题9.1 (C语言代码)浏览:702 |
C语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:566 |
1017题解浏览:660 |
数组输出 (C语言代码)浏览:744 |
找出最长的字符串来 (C语言代码)浏览:1819 |