解题思路以及注意事项:
今天给大家分享的这题不难,但很搞笑哈。
好久没写过怎么恶心的代码了,今天给大家开开眼哈。
实例代码:
#include"stdio.h" struct year { int years; int month; int days; }; int main() { int t=0; struct year yeari; scanf("%d %d %d",&yeari.years,&yeari.month,&yeari.days); if(((yeari.years%4)==0)&&(yeari.years%100)!=0||((yeari.years%400)==0)) { if(yeari.month==1) { t=yeari.days; } if(yeari.month==2) { t=yeari.days+31; } if(yeari.month==3) { t=yeari.days+31+29; } if(yeari.month==4) { t=yeari.days+31+29+31; } if(yeari.month==5) { t=yeari.days+31+29+31+30; } if(yeari.month==6) { t=yeari.days+31+29+31+30+31; } if(yeari.month==7) { t=yeari.days+31+29+31+30+31+30; } if(yeari.month==8) { t=yeari.days+31+29+31+30+31+30+31; } if(yeari.month==9) { t=yeari.days+31+29+31+30+31+30+31+31; } if(yeari.month==10) { t=yeari.days+31+29+31+30+31+30+31+31+30; } if(yeari.month==11) { t=yeari.days+31+29+31+30+31+30+31+31+30+31; } if(yeari.month==12) { t=yeari.days+31+29+31+30+31+30+31+31+30+31+30; } } else { if(yeari.month==1) { t=yeari.days; } if(yeari.month==2) { t=yeari.days+31; } if(yeari.month==3) { t=yeari.days+31+28; } if(yeari.month==4) { t=yeari.days+31+28+31; } if(yeari.month==5) { t=yeari.days+31+28+31+30; } if(yeari.month==6) { t=yeari.days+31+28+31+30+31; } if(yeari.month==7) { t=yeari.days+31+28+31+30+31+30; } if(yeari.month==8) { t=yeari.days+31+28+31+30+31+30+31; } if(yeari.month==9) { t=yeari.days+31+28+31+30+31+30+31+31; } if(yeari.month==10) { t=yeari.days+31+28+31+30+31+30+31+31+30; } if(yeari.month==11) { t=yeari.days+31+28+31+30+31+30+31+31+30+31; } if(yeari.month==12) { t=yeari.days+31+28+31+30+31+30+31+31+30+31+30; } } printf("%d",t); return 0; }
相信大家都懂了,可以在下方评论区留言,批判批判哈
0.0分
1 人评分
#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+=
点我有惊喜!你懂得!浏览:1554 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:605 |
汽水瓶 (C语言代码)浏览:659 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:1156 |
C语言训练-排序问题<1> (C++代码)浏览:628 |
C语言训练-计算1~N之间所有奇数之和 (C语言代码)浏览:687 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:581 |
字符串的输入输出处理 (C语言代码)浏览:1010 |
【蟠桃记】 (C语言代码)浏览:695 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:562 |