标签:bre else char define std mat print com main
第几天那个代码模板可以保存起来。
#include<stdio.h> #include<math.h> #define PI 3.1415927 using namespace std; int main() { int year,month,day; char a,b,d; while(scanf("%d%c%d%c%d%c",&year,&a,&month,&b,&day,&d)!=EOF) { switch(month) { case 1: day=day; break; case 2: day=31+day; break; case 3: day=31+28+day; break; case 4: day=31+28+31+day; break; case 5: day=31+28+31+30+day; break; case 6: day=31+28+31+30+31+day; break; case 7: day=31+28+31+30+31+30+day; break; case 8: day=31+28+31+30+31+30+31+day; break; case 9: day=31+28+31+30+31+30+31+31+day; break; case 10: day=31+28+31+30+31+30+31+31+30+day; break; case 11: day=31+28+31+30+31+30+31+31+30+31+day; break; default: day=31+28+31+30+31+30+31+31+30+31+30+day; } if(month>2) { if(year%100==0) { if(year%400==0) { day=day+1; printf("%d\n",day); } else { printf("%d\n",day); } } else { if(year%4==0) { day=day+1; printf("%d\n",day); } else { printf("%d\n",day); } } } else printf("%d\n",day); } }
标签:bre else char define std mat print com main
原文地址:http://www.cnblogs.com/Strugglinggirl/p/5988939.html