解题思路:比输入版判断日子简单,只需要初始化year、month、day,直接计算total
注意事项:闰年&&月份>2 才+1
参考代码:
#include <stdio.h> int main() { int year=2018,month=7,day=19,total=0; total+=day; switch(month-1) { case 11: total+=30; case 10: total+=31; case 9: total+=30; case 8: total+=31; case 7: total+=31; case 6: total+=30; case 5: total+=31; case 4: total+=30; case 3: total+=31; case 2: total+=28; case 1: total+=31; } if(year%400==0||year%4==0&&year%100!=0) if(month>2) total++; printf("%d\n",total); }
0.0分
0 人评分
【回文数(二)】 (C++代码)浏览:867 |
兰顿蚂蚁 (C++代码)浏览:1091 |
不容易系列2 (C语言代码)浏览:589 |
三角形 (C语言代码)浏览:904 |
蚂蚁感冒 (C语言代码)浏览:1324 |
1012题解浏览:865 |
【偶数求和】 (C语言代码)浏览:431 |
循环入门练习6 (C语言代码)浏览:955 |
罗列完美数 (C语言代码)浏览:491 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:667 |