打印日历
在这个颜值当道,屌丝闪边的时代,拼不过颜值拼内涵,只有知识丰富才能提升一个人的内在气质和修养,所谓人丑就要多学习,今天图老师给大家分享打印日历,希望可以对大家能有小小的帮助。
#includeconio.h
main()
{int i=0,m=0,k,j,n=0,l,first;
int x[3]={1,25,50},y=1;
int day(int);
int a[2][13]={{31,28,31,30,31,30,31,31,30,31,30,31},
{31,29,31,30,31,30,31,31,30,31,30,31}};
printf("please input the year:");
scanf("%d",&i); l=i;
first=day(i);
if(i%4==0)k=1;
else k=0;
i=0;
while(m++2)
{clrscr();
printf(" %d",l);
for(;i6*m;i++)
{
if(i6)y=(i/3)*8+2; else y=((i-6)/3)*8+2 ;
gotoxy(x[i%3],y);
printf(" %d",i+1);
gotoxy(x[i%3],++y);
printf(" su mo tu we th fr sa");
gotoxy(x[i%3],++y);
for(n=0;nfirst;n++)
printf(" ");
for(j=1;j=a[k][i];j++)
{printf("%3d",j);
if((first+j)%7==0)
gotoxy(x[i%3],++y);}first=(first+a[k][i])%7;
} if(m==1) printf("any key to continue");
else printf("Any key to end");
getch(); }
}
day(int i)
{int k,s=0;
if(i2000)
{for(k=2000;ki;k++)
if(k%4==0) s=s+366;
else s=s+365;
return((s+6)%7);}
else if(i=2000) return(5);
else
{for(k=i;k2000;k++)
if(k%4==0)s=s+366;
else s=s+365;
return(7-(s+6)%7);}
}