修改程序大神请进啊
程序代码:
#include<stdio.h> #include<stdlib.h> int main() { int year,a,b,c,n,m,s,i=1; char p = 0; while(1) { if(i==1) printf("请输入年份!\n"); if(i>1) { printf("继续查询请按y,其他键退出!\n"); scanf("%c",&p); if(p!='y') exit(0); printf("请输入年份!\n"); //此数也可以加个system("cls"); } scanf("%d",&year); getchar();//接受回车 printf("\t\t\t%d年\n",year); a=((year-1)+(year-1)/4-(year-1)/100+(year-1)/400+1)%7; for(n=1;n<=12;n++) { printf("%d月\n\n",n); printf("日\t一\t二\t三\t四\t五\t六\n"); if(n==1) for(m=0;m<a;m++) printf("\t"); else { a=(a+s%7)%7; for(m=0;m<a;m++) printf("\t"); } switch(n) { case 1: case 3: case 5: case 7: case 8: case 10: case 12:s=31;break; case 4: case 6: case 9: case 11:s=30;break; case 2: if(((year%4==0)&&(year%100!=0))||(year%400==0)) s=29; else s=28; break; } for(b=1;b<=s;b++) { printf("%d\t",b); c=a+b; if(c%7==0) printf("\n"); } printf("\n\n"); }//for结束 i++;//改变i的值,使i满足i>1 }//while结束 system ("pause"); return 0; }谁能帮我改成这样的显示方式啊,改成年月查询的程序界面要求如下:
“请输入要查询的年份和月份(格式:年份-月份)”
如用户输入:2013-10