如何用C语言编程一个滚动的小球 最好是五彩的 滚动的

来源:百度知道 编辑:UC知道 时间:2024/09/22 11:33:31

#include"graphics.h"
#include"stdlib.h"
main()
{
int i,gdriver,gmode,size,*buf;
gdriver=DETECT;
initgraph(&gdriver,&gmode," ");
setbkcolor(BLACK);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,1);
setfillstyle(1,4);
circle(100,200,20);
floodfill(100,200,12);
size=imagesize(79,159,131,231);
buf=malloc(size);
getimage(79,159,131,231,buf);
putimage(530,269,buf,COPY_PUT);
getch();
for(i=0;i<200;i++)
{
putimage(75+i,160,buf,COPY_PUT);
putimage(515-i,160,buf,COPY_PUT);
}
for(i=0;i<200; i++)
{
putimage(270-i,160,buf,COPY_PUT);
putimage(320+i,160,buf,COPY_PUT);
}
getch();
closegraph();
}