#include<stdio.h>
#include<conio.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("\n\nplease 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(;i<6*m;i++)
{
if(i<6)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;n<first;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("\n\nany key to continue");
else printf("\n\nAny key to end");
getch(); }
}
day(int i)
{int k,s=0;
if(i>2000)
{for(k=2000;k<i;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;k<2000;k++)
if(k%4==0)s=s+366;
else s=s+365;
return(7-(s+6)%7);}
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |