在wintc下 写了一个有关圆的图像小程序;
#include<stdio.h>
#include<graphics.h>#include<conio.h>
#include<bios.h>
up(int x,int y)
{
cleardevice();
circle(x,y+2,25);
}
down(int x,int y)
{
cleardevice();
circle(x,y+2,25);
}
left(int x,int y)
{
cleardevice();
circle(x+2,y,25);
}
right(int x,int y)
{
cleardevice();
circle(x-2,y,25);
}
void main()
{
int gdriver,gmode,i=387,j=288;
char key;
printf("HELLO!!!\n Press any key to continue....");
printf("written by Lin Duan \n");
getch();
gdriver=DETECT;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver,&gmode,"");
setbkcolor(GREEN);
setcolor(RED);
circle(i,j,26);
sleep(1);
system("pause");
printf("If you want to exit,press'......");
getch();
clrscr();
while(1)
{ key=getch();
switch(key)
{case 'w':
up(i,j);
j=j-2;
continue;
case 's':
down(i,j);
j=j+2;
continue;
case 'a':
left(i,j);
i=i-2;
continue;
case 'd':
right(i,j);
i=i+2;
continue;
case '`':
exit(0);
}
}
closegraph();
}
背景色,安健都可以自己随意改的