圆的代码用C语言编的(不是VC++或C++编的)
发布网友
发布时间:2022-09-07 01:39
我来回答
共1个回答
热心网友
时间:2024-12-13 06:42
/*调试环境:tc2.0*/
#include <graphics.h>
#include <stdio.h>
#include <math.h>
#include <dos.h>
void move_circle(int x,int y,int r)
{int i,j;
for (i=-r;i<=r;i++)
{j=(int)sqrt(r*r-i*i);
putpixel(x+i,y-j,15);
delay(10000);
putpixel(x+i,y-j,1);}
for (i=r;i>=-r;i--)
{j=(int)sqrt(r*r-i*i);
putpixel(x+i,y+j,15);
delay(10000);
putpixel(x+i,y+j,1);
}
}
main()
{int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");/*填入TC2.0的所在目录(在""内),如:"c:\\turboc2"*/
setcolor(1);
circle(300,200,100);
move_circle(300,200,100);
getch();
closegraph();
}