mxh1998 2008-3-26 22:50
人月团圆:用C实现的爱情宣言
人月团圆:用C实现的爱情宣言
#include "stdio.h"
#include "graphics.h"
#include "time.h"
#include "math.h"
#define N 2
#define TIME 0.8/*微粒的的运动时间,TIME/步,每一步长为25个单位*/
void *buf[N];
struct
{
int x,y;
} lizi[]={{0,0},{75,75}};
void alter_place_lizi(int *x,int *y,int key)/*根据随机方向改变粒子的方位*/
{
switch(key)
{case 0:
case 1:
case 2:*x-=25;break;
case 4:
case 5:
case 6:*x =25;break;
}
switch(key)
{ case 0:
case 7:
case 6:*y-=25;break;
case 2:
case 3:
case 4:*y =25;break;
}
if(*x<0) *x=0;
if(*x>250) *x=250;
if(*y<0) *y=0;
if(*y>250) *y=250;
}
void make_graphics()/*画方框*/
{int i,j,driver=VGA,mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,1);
for(i=0;i<=10;i )
line(0,25*i,250,25*i);
for(i=0;i<=10;i )
line(25*i,0,25*i,250);
}