#include #include #include #include #include #include int gd,gm,x,y,n,h,x1,x2,x3,x4,y1,y2,y3,y4,xc,yc,l,i; int xmax,ymax,raza,dx,dy; void main(void) { clrscr(); //cleardevice(); randomize(); void *p; printf("Raza="); scanf("%d",&raza); detectgraph(&gd,&gm); initgraph(&gd,&gm,"C:\\borlandc\\bgi"); cleardevice(); xmax=getmaxx(); ymax=getmaxy(); xc=xmax/2; yc=ymax/2; x1=xc-raza-1; y1=yc-raza-1; x2=xc+raza+1; y2=yc+raza+1; line(0,0,0,ymax); line(0,ymax,xmax,ymax); line(xmax,ymax,xmax,0); line(xmax,0,0,0); circle(xc,yc,raza); p=malloc(imagesize(x1,y1,x2,y2)); getimage(x1,y1,x2,y2,p); setcolor(BLACK); circle(xc,yc,raza); setcolor(WHITE); dx=1; dy=1; x=xc; y=yc; for(i=0;i<=1000;i++) { putimage(x,y,p,XOR_PUT); delay(1); putimage(x,y,p,XOR_PUT); x=x+dx; y=y+dy; if ((x==xmax-2*raza) || (x<=1) ) dx=-dx; if ((y==ymax-2*raza) || (y<=1) ) dy=-dy; } getch(); // closegraph(); }