解题思路以及注意事项:
今天给大家分享的这题不难,但很搞笑哈。
好久没写过怎么恶心的代码了,今天给大家开开眼哈。
实例代码:
#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+=
点我有惊喜!你懂得!浏览:2754 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:595 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:690 |
C语言程序设计教程(第三版)课后习题9.2 (Java代码)浏览:697 |
母牛的故事 (C语言代码)浏览:992 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:644 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:631 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:701 |
幸运数 (C++代码)浏览:1309 |
图形输出 (C语言代码)浏览:1425 |