1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| struct Line{ int x1, y1, x2, y2 }; struct Ellipse{ int x, y, r; }; struct Rectangle{ int lef, top, rig, bot; }
Line figures_L[100]; Rectangle figures_R[100]; Ellipse firgures_E[100];
enum FIGURE_TYPE {LINE, RECTANGLE, ELLIPSE}; struct Line{ FIGURE_TYPE t ; int x1, y1, x2, y2; }; struct Ellipse{ FIGURE_TYPE t; int x, y, r; }; struct Rectangle{ FIGURE_TYPE t; int left, top, rig, bot; } union FIGURE{ FIGURE_TYPE t; Line line; Rectangle rect; Ellipse ellipse; };
FIGURE figures[100]; void main() { input( figures, 100 ); for (int i=0;i<100;i++) draw(figures[i]); }
void draw_line(int,int,int,int); void draw_rect(int,int,int,int); void draw_ellipse(int,int,int);
|