初学者..这个日历代码怎么转化为每一个季度换一行.
就是 每三个月换一行.2013年日历
一季
1,2,3
二季
4,5,6
三季
7,8,9
四季
10,11,12
谢谢啦..
程序代码:
#include <stdio.h> void main() { int i,j,k,year=2013,week; int day[]={31,28,31,30,31,30,31,31,30,31,30,31}; char month[12][10]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}; if((year%4==0&&year%100!=0)||(year%400==0)) day[1]++; week=(35+year+year/4-year/100+year/400)%7; printf("2013年日历\n"); for(i=0;i<12;i++) { if (i==3) printf("\n"); printf("\n%s\n\n",month[i]); printf("日 一 二 三 四 五 六\n"); for(k=0;k<week;k++) printf(" "); for(j=1;j<=day[i];j++) { printf("%2d ",j); if(++week>=7) { printf("\n"); week=week%7; } } printf("\n"); } }