#include<string.h>
#include<bios.h>
#include<stdlib.h>
#include<conio.h>
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define ESC 0x011b
#define ENTER 0x1c0d
char *a[4]={"left","right","up","down"};
int num=3000,key,year=2006;
int i,j,first=3,w=30;
char *month[12]={"Junuary","February","March","April","May","June","July","August","September","October","November","December"};
int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int fd[12]={0};
int getkey()
{char lowbyte;
int press;
while(bioskey(1)==0)
press=bioskey(0);
lowbyte=press&0xff;
press=press&0xff00+toupper(lowbyte);
return(press);
}
void sch()
{window(22,24,30,24);
textbackground(GREEN);
clrscr();
textcolor(15);
cprintf("\n Search");}
void sch_0()
{window(22,24,30,24);
textbackground(GREEN);
clrscr();
textcolor(128);
cprintf("\n Search ");}
void backk()
{window(33,24,42,24);
textbackground(GREEN);
clrscr();
textcolor(15);
cprintf("\n Month1-4");}
void backk_0()
{window(33,24,42,24);
textbackground(GREEN);
clrscr();
textcolor(128);
cprintf("\n Month1-4");}
void left()
{
window(45,24,54,24);
textbackground(GREEN);
clrscr();
textcolor(15);
cprintf("\n Month5-8");}
void left_0()
{
window(45,24,54,24);
textbackground(GREEN);
clrscr();
textcolor(128);
cprintf("\n Month5-8");}
void right()
{window(57,24,67,24);
textbackground(GREEN);
clrscr();
textcolor(15);
cprintf("\n Month9-12");}
void right_0()
{window(57,24,67,24);
textbackground(GREEN);
clrscr();
textcolor(128);
cprintf("\n Month9-12");}
void iexit()
{window(70,24,77,24);
textbackground(GREEN);
clrscr();
textcolor(15);
cprintf("\n Exit");}
void iexit_0()
{window(70,24,77,24);
textbackground(GREEN);
clrscr();
textcolor(128);
cprintf("\n Exit");}
void jiance(int n)
{switch(n)
{case 0:sch_0();left();right();iexit();backk();break;
case 1:backk_0();left();right();iexit();sch();break;
case 2:left_0();right();iexit();sch();backk();break;
case 3:right_0();left();iexit();sch();backk();break;
case 4:iexit_0();left();right();sch();backk();break;
default:exit(0);
}
}
void quzhi()
{window(8,24,20,24);
textbackground(15);
clrscr();
textcolor(RED);
cscanf("%d",&year);
}
void month1_4()
{
for(i=0;i<2;i++)
{window(2+i*w,3,29+w*i,11);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s\n",month[i]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i]-1)+1,3);
for(j=1;j<=mon[i];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i])%7;
if(first==0)first=7;*/
}
for(i=2;i<4;i++)
{window(2+(i-2)*w,13,29+w*(i-2),21);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s\n",month[i]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i]-1)+1,3);
for(j=1;j<=mon[i];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i])%7;
if(first==0)first=7;*/
}
}
void month5_8()
{for(i=0;i<2;i++)
{window(2+i*w,3,29+w*i,11);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s\n",month[i+4]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i+4]-1)+1,3);
for(j=1;j<=mon[i+4];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i+4])%7;
if(first==0)first=7;*/
}
for(i=2;i<4;i++)
{window(2+(i-2)*w,13,29+w*(i-2),21);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s",month[i+4]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i+4]-1)+1,3);
for(j=1;j<=mon[i+4];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i+4])%7;
if(first==0)first=7;*/
}
}
void month9_12()
{for(i=0;i<2;i++)
{window(2+i*w,3,29+w*i,11);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s\n",month[i+8]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i+8]-1)+1,3);
for(j=1;j<=mon[i+8];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i+8])%7;
if(first==0)first=7;*/
}
for(i=2;i<4;i++)
{window(2+(i-2)*w,13,29+w*(i-2),21);
textbackground(5);
clrscr();
textcolor(GREEN);
cprintf(" %s",month[i+8]);
gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun");
gotoxy(4*(fd[i+8]-1)+1,3);
for(j=1;j<=mon[i+8];j++)
{cprintf("%3d ",j);
/*if((first+j-1)%7==0)putchar('\n');*/
}
/*first=(first+mon[i+8])%7;
if(first==0)first=7;*/
}
}
void calendar(int year)
{int x,cha;
long day=0;
window(1,2,80,22);
textbackground(YELLOW);
clrscr();
if(year<2007)
{for(x=year;x<2007;x++)
{if((x%4==0&&x%100!=0)||x%400==0)
day+=366;
else day+=365;}
cha=day%7;
first=(7+1-cha)%7;
if(first==0)first=7;
}
if(year==2007)first=1;
if(year>2007)
{for(x=2007;x<year;x++)
{if((x%4==0&&x%100!=0)||x%400==0)
day+=366;
else day+=365;}
cha=day%7;
first=(1+cha)%7;
if(first==0)first=7;
}
if((year%4==0&&year%100!=0)||year%400==0)
mon[1]=29;
else mon[1]=28;
fd[0]=first;
for(j=1;j<12;j++)
{fd[j]=(fd[j-1]+mon[j-1])%7;
if(fd[j]==0)fd[j]=7;}
month1_4();}
void jiance2(int n)
{void nian(int year);
switch(n)
{case 0:getch( );quzhi();calendar(year);nian(year);break;
case 1:month1_4();break;
case 2:month5_8();break;
case 3:month9_12();break;
case 4:exit(0);break;
default:exit(0);}
}
void ping()
{clrscr();
window(1,1,80,1);
textbackground(RED);
clrscr();
gotoxy(6,1);
textcolor(GREEN);
cprintf("FILE Record Link Help");
window(2,1,4,1);
textbackground(0);
clrscr();
window(1,2,80,22);
textbackground(YELLOW);
clrscr();
window(1,23,80,25);
textbackground(BLUE);
clrscr();
window(8,24,20,24);
textbackground(15);
clrscr();
sch_0();
left();
right();
iexit();
backk();
calendar(2006);
}
void copyright()
{clrscr();
window(15,5,65,15);
textbackground(RED);
clrscr();
textcolor(GREEN);
cprintf("\n Calendar\n");
gotoxy(1,4);
cprintf(" My QQ: 331349451 Tel:08135507131\n");
gotoxy(1,6);
cprintf(" >September 19th,2006");
gotoxy(1,8);
cprintf(" Sichuan University of Scienc and Engineering ");
gotoxy(1,10);
cprintf(" Jingxi Class 2,Grade 2004");
}
void nian(int year)
{window(62,5,78,5);
textbackground(RED);
clrscr();
textcolor(GREEN);
cprintf("\n Calendar");
window(64,7,75,11);
textbackground(15);
clrscr();
textcolor(1);
cprintf("\n Year");
gotoxy(3,4);
cprintf("%6d",year);
window(62,13,78,20);
textbackground(8);
clrscr();
textcolor(9);
cprintf("\n Copyright(c)");
gotoxy(1,4);
cprintf(" Xieyan Wei");
gotoxy(1,6);
cprintf(" xieyanwei1985@163.com");
return;
}
main()
{clrscr();
window(1,1,80,1);
textbackground(RED);
clrscr();
gotoxy(6,1);
textcolor(GREEN);
cprintf("FILE Record Link Help");
window(2,1,4,1);
textbackground(0);
clrscr();
window(1,2,80,22);
textbackground(YELLOW);
clrscr();
window(1,23,80,25);
textbackground(BLUE);
clrscr();
window(8,24,20,24);
textbackground(15);
clrscr();
copyright();
sch_0();
backk();
left();
right();
iexit();
getch();
ping();
calendar(2006);
nian(2006);
while(key!=28)
{if(bioskey(1))key=bioskey(0);
switch(key)
{case LEFT:num--;jiance(num%5);key=0;break;
case RIGHT:num++;jiance(num%5);key=0;break;
case ENTER:jiance2(num%5);key=0;break;
case ESC:exit(0);
default:key=0;break;}
}
}