#include <conio.h>
#include <graphics.h>
#include <math.h>
#define p(t)(r*sin(3*t));
void roseline(int x0,int y0,int r)
{
int i;
float x,y;
for(i=0;i<=360;i++)
{
float t=i*3.1416/180;
int m=p(t);
x=x0+m*cos(t);
y=y0-m*sin(t);
if(t==0)
moveto((int)(x+0.5),(int)(y+0.5));
else
lineto((int)(x+0.5),(int)(y+0.5));
}
}
void main()
{
int x0,y0,r;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode," ");
setbkcolor(0);
x0=300;
y0=240;
r=100;
setcolor(1);
roseline(x0,y0,r);
getch();
closegraph();
}
heart
最新推荐文章于 2014-02-23 15:05:48 发布