I really appreciate!
#include
#include
#include
#include
# defineFNX (x) (int) (xo + (x) * 1.0)
# defineFNY (y) (int) (getmaxy () - (1.0) yukio okamoto, + (y) *)
# defineFNX2 (phi) cos (phi) * ac - sin (phi) * bs
# defineFNY2 (phi) cos (phi) * as + sin (phi) * BC
/* picture rotating elliptical */
Voidelli (int xo, int, yukio okamoto, int a, b int, double theta)
{
int i;
Double da, c, s, ac, the as, BC, bs, xf, yf, phi, x, y;
Theta equals theta * 0.01745;
Da=3 * 0.1745;
C=cos (theta); S=sin (theta);
Ac=a * c; As=a * s; BC=b * c; Bs=b * s;
X=FNX2 (0); Y=FNY2 (0);
Moveto (FNX (x), FNY (y));
for(i=1; i<=360; I++)
{
Phi=I * da; Xf=x * cos (phi) * 0.1; Yf=b * sin (phi) * 0.1;
X=FNX2 (phi); Y=FNY2 (phi);
The lineto (FNX (x), FNY (y));
}
}
/* spend */
Voidhua (int x, int y)
{
Register the I;
/* * painted pink rose/
Setcolor (12);
The arc (x + 65, y - 60150350, 8).
The arc (x + 66, y - 54300470, 8).
The arc (x + 65, y - 56,30,230,10);
The arc (x + 64, y - 57300490);
The ellipse,27,40 (x + 73, y - 30250450);
The ellipse (59 x + y - 30100290,27,40);
The ellipse (x + 65, y - 40140270-30);
Setfillstyle (SOLID_FILL, 5);
Floodfill (x + 65, y - 20, 12);
/* * painted red rose/
The arc (x, y, 150350, 12);
The arc (x + 1, y + 8280470, 12);
The arc (x, y + 2,30,230,16);
The arc (x, y + 3,80,240,28);
Arc (x + 2, y + 8180330, 22).
Arc (+ 2310460-2 x, y, 25).
The ellipse (30120300-12 x, y +,30,40);
The ellipse (+ 10 x, y + 28250423,30,42);
The ellipse (10290393-4 x, y +,30,40);
Setfillstyle (SOLID_FILL, 4);
Floodfill (y + x + 5, 31, 12);
/* painted purple huaguduo */
The ellipse (x + 120, y + 5,0,360,15,25);
Setfillstyle (SOLID_FILL, 1);
Floodfill (+ 120 x, y, 12);
Paint huaguduo yellow/* */
The ellipse (x - 70, y + 10,0,360,14,20);
Setfillstyle SOLID_FILL, (14);
Floodfill (x - 70, y + 10, 12);
Setcolor (10);
/* painted red flower calyx */
The ellipse (15 x, y + 32190310,30,35);
The ellipse (+ 16 x, y + 32235355,26,35);
The ellipse (x, y + 35190350,43,50);
The arc (x, y + 82190350, 6);
Setfillstyle (SOLID_FILL, 2);
Floodfill (x, y + 75, 10);
/* painted pink flower calyx */
The ellipse (x + 50, y - 48190320,22,50);
The ellipse,22,50 (x + 80, y - 48220350);
The ellipse,36,50 (x + 65, y - 28180360);
Floodfill (x + 65, y + 18, 10);
/* draw a central */
for(i=0; i<3; I++)
{
The ellipse (x - 98, y + + I, 100, 255371100);
The ellipse (x - 20, 30 + y + I, 260358140140);
The ellipse (x + 224, y + I + 20, 180218160140);
}
/* draw collateral */
The ellipse (x + 70, y + 34180233140140);
The ellipse (x, y + 40205255100120);
The ellipse,72,120 (x + 135, y - 30209249);
The ellipse (x, y + 20263301100120);
The ellipse (x + 85, y - 10278305100120);
The ellipse,90,120 (x + 100, y - 62282308);
The ellipse (,30,120-50 x, y - 10277314);
The ellipse (x + 70, + 80222266 y,52,120);
The ellipse,52,120 (60 x, y - 45229266);
The ellipse,52,120 (x + 79, y - 45229266);
The ellipse (224273 + 84 x, y,,52,120);
The ellipse (x + 110, y + 40240282100120);
/* painted purple flower GuDuo calyx */
The ellipse,17,25 (x + 120, y - 6200340);
The ellipse (x + 120, + 7160380 y,17,27);
Floodfill (x + 122, y + 30, 10);
/* painted yellow huaguduo calyx */
The ellipse (x - 70, y + 15140390,17,20);
The ellipse (x - 75, y - 10205340,10,30);
The ellipse,5,30 (60 x, y - 10195340);
Floodfill (x - 70, y + 32, 10);
/* draw leaf */
/* picture on the right side of the leaf */
Elli (x + 168, + 282,10,20 y, - 40);
Elli (x + 160, + 252 y,8,16,260);
Elli (x + 145, + 270 y,8,16, 15);
Elli (x + 156, + 224,10,20 y, - 45);
Elli (x + 150, + 200 y,8,16,270);
Elli (x + 135, + 220,8,16 y, - 10);
Elli (x + 146, + 144,8,16 y, - 80);
Elli (x + 130, + 130 y,6,12,235);
Elli (x + 125, + 154,7,14 y, - 10);
Elli (x + 78, + 98,6,12 y, - 90);
Elli (x + 60, y + 90,5,10,180);
Elli (x + 70, + 109,5,10 y, - 45);
/* picture on the left side of the leaf */
Elli (x - 125, y + 270,12,24,60);
Elli (x - 95, y + 270,10,20,10);
Elli (x - 110, y + 245,10,20,90);
Elli (x - 105, y + 220,10,20,45);
Elli (x - 100, y + 190,8,16,135);
Elli (x - 75, y +,8,16, 210-45);
/* painting in the middle of the leaf */
Elli (x + 65, + 190,10,20 y, - 45);
Elli (40, x + y + 185,8,16,0);
Elli (55, x + y + 165,8,16,90);
}
/* the main program */
The main ()
{
Int driver=VGA, mode=VGAHI;
Initgraph (& amp; Driver, & amp; Mode, "C: \ \ TC");
Cleardevice ();
Hua (450, living);
; Setcolor (10);
A rectangle (0,0,639,479);
Getch ();
Closegraph ();
}
Online etc.
CodePudding user response:
This is under DOS drawing program, there is no complex logicThe main ()
{
Int driver=VGA, mode=VGAHI;
Initgraph (& amp; Driver, & amp; Mode, "C: \ \ TC");//initialize graphics system
Cleardevice ();//remove graphics
Hua (450, living);//painting flowers, the above function, mainly composed of elliptical and linear
; Setcolor (10);//set colors
A rectangle (0,0,639,479);//painting outside box
Getch ();//receive keys
Closegraph ();//close graphics system
}
This program is not difficult, mainly the original poster don't listen well in class
CodePudding user response:
Is first defines a elli rotating elliptical function picture, and then call this function as well as the standard of ellipse, such as straight line function to draw a flower parts, in the end of a flower