C语言写的一个万年历
作者:寒川 发布于:2006-9-23 17:33 Saturday 分类:计算机
#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;}
}
}
二级是狗屎
作者:寒川 发布于:2006-9-23 16:51 Saturday 分类:点滴心情
我不是因为没考过2级才这么说。虽然我很想过2级,但是说实在的,就我们这些非计算机专业的学生,过了二级也还是计算机白痴,这可不是吹牛的!什么C语言,什么VB,什么Access,学得要懂不懂的。一点适用价值都没有。但是出去工作企业要看你的计算机等级证书。真不知道那些老板们是怎么想的。其实他们一点都不知道,即使是过了计算机2级的,也没几个能搞出一个多么好的程序来。
我报了两次计算机了,即使这次能过,我照样说2级是狗屎。这不是吹的!……
还不如学点有用的计算机基础。比如:Powerpint、 Word、Fontpage、Excel、Auto CAD、Photoshop CS。呵呵~~我觉得这些比起无聊的程序来安逸得多了。
上网中
作者:寒川 发布于:2006-9-21 16:01 Thursday 分类:点滴心情
又快要2级考试了,不知道这次是否能过?真他妈的难. 好不安逸哦。想认真学习C现在是不可能的了。最近特别喜欢C,但是以前学了都忘了好多。怎么考试?!
搬校区了
作者:寒川 发布于:2006-7-14 19:12 Friday 分类:点滴心情
搬校区了。真是不安逸!
标签: 心情
日志分类
最近日志
随机日志
最新评论
- 龙岩包皮茎院
情人节应该出去... - 龙岩医院
多更新还是不错... - Vseven、
评论这里的用QQ... - CCC certification
对这块还真是不... - 那风筝
happy new year ! - Roy
你好, 交换个链... - 太阳城娱乐网
说实话,对钛白... - 卡特&&艾弗森
不错啊!!,过段... - 奇遇
沙发 - 寒川
@Mr.邱℡:现在可...
日志档案
- 2012年2月(2)
- 2011年11月(2)
- 2011年9月(1)
- 2011年8月(2)
- 2011年7月(2)
- 2011年5月(1)
- 2011年3月(3)
- 2011年2月(2)
- 2010年12月(1)
- 2010年11月(2)
- 2010年10月(3)
- 2010年9月(9)
- 2010年8月(8)
- 2010年7月(13)
- 2010年6月(18)
- 2010年5月(24)
- 2010年4月(10)
- 2010年3月(14)
- 2010年2月(6)
- 2010年1月(7)
- 2009年11月(2)
- 2009年10月(3)
- 2009年9月(3)
- 2009年8月(8)
- 2009年7月(15)
- 2009年6月(14)
- 2009年4月(2)
- 2008年12月(1)
- 2008年6月(1)
- 2008年5月(10)
- 2008年4月(9)
- 2008年3月(5)
- 2008年2月(2)
- 2008年1月(5)
- 2007年12月(4)
- 2006年9月(6)
- 2006年7月(1)


