解题思路:
注意事项:
参考代码:
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int main() { struct time { int year; int month; int day; }; typedef struct time SJ; SJ str; cin>>str.year>>str.month>>str.day; int xb=0; if((str.year%4==0&&str.year%100!=0)||(str.year%400==0)) { xb+=1; } int cns=0; switch(str.month) { case 1:cns=0;break; case 2:cns=31;break; case 3:cns=59;break; case 4:cns=90;break; case 5:cns=120;break; case 6:cns=151;break; case 7:cns=181;break; case 8:cns=212;break; case 9:cns=243;break; case 10:cns=273;break; case 11:cns=304;break; case 12:cns=334;break; } cns=cns+xb+str.day; cout<<cns<<endl; return 0; }
0.0分
0 人评分
printf基础练习2 (C语言代码)浏览:942 |
【出圈】 (C语言代码)浏览:794 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:763 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:552 |
WU-图形输出 (C++代码)浏览:802 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:528 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:632 |
母牛的故事 (C语言代码)浏览:549 |
震宇大神的杀毒软件 (C语言代码)浏览:1079 |
简单的a+b (C语言代码)浏览:533 |