解题思路:
注意事项:
参考代码:
#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 人评分
A+B for Input-Output Practice (VII) (C++代码)浏览:714 |
整人!!浏览:839 |
【蟠桃记】 (C++代码)(递归计算)浏览:971 |
永远的丰碑 (C语言代码)浏览:656 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:597 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:632 |
C语言训练-斐波纳契数列 (C语言代码)浏览:1174 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:756 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:690 |
用筛法求之N内的素数。 (C语言代码)浏览:669 |