Windows画五角星
void drawstar(HDC hdc,double x,double y,double line)
{
double linelength=line;
double next_x=x,next_y=y;
MoveToEx(hdc,next_x,next_y,NULL);
/*下一个点:x:是该点的x减去边长乘cos72度*/
/*下一个点:y:是该点的y加上边长乘sin72度*/
next_x=next_x-linelength*cos(2*PI/5);
next_y=next_y+linelength*sin(2*PI/5);
LineTo(hdc,next_x,next_y);//连线
/*计算下一个点的坐标*/
next_x=next_x+linelength*cos(PI/5);
next_y=next_y-linelength*sin(PI/5);
LineTo(hdc,next_x,next_y);//连线
/*计算下一个点的坐标*/
next_x-=linelength;
LineTo(hdc,next_x,next_y);//连线
/*计算下一个点的坐标*/
next_x=next_x+linelength*cos(PI/5);
next_y=next_y+linelength*sin(PI/5);
LineTo(hdc,next_x,next_y);//连线
LineTo(hdc,x,y);//连到起点
}