Int g ____ times = 0; double G ____ X1, G ____ Y1, G ____ X2, G ____ Y2; # definepi (3.14159) void drawfive (cclientdc * DC) {DC-> ellipse (G ____ x2-2, G ____ Y2-2, G ____ X2 + 2, G ____ y2 + 2); // P1, the center of P2 is double tx1, ty1; tx1 = (G ____ X1 + G ____ x2)/2; ty1 = (G ____ Y1 + G ____ Y2)/2; // dc-> ellipse (tx1-2, ty1-2, tx1 + 2, ty1 + 2); // dc-> moveTo (G ____ X1, G ____ Y1 ); // dc-> lineto (G ____ X2, G ____ Y2); // calculates the angle of P1 and P2, double angle; angle = (G ____ Y2-G ____ Y1) /(g ____ x2-G ____ X1); If (angle> 1000000.0) {angle = PI/2;} else {angle = atan (angle );} angle + = PI/2; double G ____ CX, G ____ Cy; Double E; // the distance from the center to the center of the Double T; // P1, T = SQRT (g ____ Y2-G ____ Y1) * (G ____ Y2-G ____ Y1) + (G ____ x2-G ____ X1) * (G ____ x2-G ____ X1); T/= 2.0; E = T * 1.3763819204711735382072095819109; // draw the center g ____ Cx = tx1 + E * Cos (angle ); g ____ Cy = ty1 + E * sin (angle); DC-> ellipse (G ____ CX-2, G ____ cy-2, G ____ cx + 2, g ____ Cy + 2); // calculate the angle from the first point to the center of the circle = atan (g ____ Y1-G ____ CY) /(g ____ x1-G ____ CX); angle + = (PI/5); // calculate the coordinates of five vertices, double X [5], Y [5]; double R; r = SQRT (g ____ Y2-G ____ CY) * (G ____ Y2-G ____ CY) + (G ____ x2-G ____ CX) * (G ____ x2-G ____ CX); int I; for (I = 0; I <5; I ++) {x [I] = g ____ cx + R * Cos (angle); y [I] = g ____ Cy + R * sin (angle ); angle + = (pI * 2/5); DC-> ellipse (X [I]-2, Y [I]-2, X [I] + 2, Y [I] + 2);} Int J; for (I = 0; I <5; I ++) {J = (I + 2) % 5; DC-> moveTo (X [I], Y [I]); DC-> lineto (X [J], Y [J]) ;}} void ctestfivedlg :: onlbuttonup (uint nflags, cpoint point) {// todo: add your message handler code here and/or call defaultif (G ____ times % 2) {g ____ X2 = point. x; G ____ y2 = point. y; cclientdc DC (this); drawfive (& DC);} else {g ____ X1 = point. x; G ____ Y1 = point. y; cclientdc DC (this); DC. ellipse (G ____ x1-2, G ____ Y1-2, G ____ X1 + 2, G ____ Y1 + 2);} g ____ times ++; cdialog :: onlbuttonup (nflags, point );}