给大家看张渔网,运行的时候请设置好图形驱动的路径。
#include <graphics.h>
#include <math.h>
void ellip(int x0,int y0,int a,int b,int dt)
{int x,y,n,i;
float t1,t=0;
t1=dt*0.0174533;
n=360/dt;
moveto(x0+a,y0);
for(i=1;i<n;i++)
{t=t+t1;
x=x0+a*cos(t);
y=y0+b*sin(t);
lineto(x,y);
}
lineto(x0+a,y0);
}
main()
{int i,a=200,x=320,y=200;
int driver=DETECT,mode;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"");
cleardevice();
setbkcolor(9);
setcolor(4);
for(i=0;i<=200;i=i+10)
{ellip(x,y,a-i,i,10);
}
getch();
closegraph();
}
评论