解题思路:
注意事项:
参考代码:
#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语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:998 |
简单的a+b (C语言代码)浏览:752 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:597 |
【计算两点间的距离】 (C语言代码)浏览:1522 |
Hello, world! (C++代码)浏览:1778 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:350 |
模拟计算器 (C++代码)浏览:885 |
蛇行矩阵 (C语言代码)浏览:559 |
永远的丰碑 (C语言代码)浏览:608 |
小O的数字 (C语言代码)浏览:1490 |