Home > Back-end >  The project to run for the first time to print out the house, why when the second time in the follow
The project to run for the first time to print out the house, why when the second time in the follow

Time:09-18

# include "graphics. H"
# include "genlib. H"
#include
# define Len 1.2

Void DrawTri (double x, double y, double z);
Void DrawRec (double x, double y, double z);

Void Main ()
{
Double w, h, len;
Double W, H;

InitGraphics ();

W=GetWindowWidth ();
H=GetWindowHeight ();
W=w/2.0;
H=h * 2/3.0;
Len=len/6.0;

//to draw two triangle
DrawTri (2 * Len, w - h - Len, Len);
DrawTri (w + Len, h - Len, Len);

//draw large square
DrawRec (w - Len, h - Len, Len);
DrawRec (2 * Len, w - h - Len, Len);
DrawRec (w - Len, h, Len);
DrawRec (w - 2 * Len, h, Len);
DrawRec (w, h - Len, Len);
DrawRec (w + Len, h - Len, Len);
DrawRec (w, h, Len);
DrawRec (w + Len, h, Len);

//draw a small square
Len DrawRec (w - 6 * and h - 7 * len, len);
DrawRec (* len, w - 4 h - 7 * len, len);
DrawRec (2 * len, w - h - 7 * len, len);
DrawRec (w + 2 * len, h - 7 * len, len);
Len DrawRec (w + 4 * and h - 7 * len, len);
DrawRec (w + 6 * len, h - 7 * len, len);

return;
}

Void DrawTri (double x, double y, double z)//in the lower left corner of the origin counterclockwise
{
MovePen (x, y);
Double h=z * SQRT (3)/2;
DrawLine (z, 0);
DrawLine (z/2 h);
DrawLine (z/2 - h);
}

Void DrawRec (double x, double y, double z)//in the upper left corner of the origin clockwise
{
MovePen (x, y);
DrawLine (z, 0);
DrawLine (0, z);
DrawLine (z, 0);
DrawLine (0, z);
}

CodePudding user response:

Sorry code stick a wrong
# include "graphics. H"
# include "genlib. H"
#include
# define Len 1.2

Void DrawTri (double x, double y, double z);
Void DrawRec (double x, double y, double z);

Void Main ()
{
Double w, h, len;
Double W, H;

InitGraphics ();

W=GetWindowWidth ();
H=GetWindowHeight ();
W=w/2.0;
H=h * 2/3.0;
Len=len/6.0;

//to draw two triangle
DrawTri (w - 2 * Len, h, Len);
DrawTri (w + Len, h, Len);

//draw large square
DrawRec (w - Len, h - Len, Len);
DrawRec (2 * Len, w - h - Len, Len);
DrawRec (w - Len, h, Len);
DrawRec (w - 2 * Len, h, Len);
DrawRec (w, h - Len, Len);
DrawRec (w + Len, h - Len, Len);
DrawRec (w, h, Len);
DrawRec (w + Len, h, Len);

//draw a small square
Len DrawRec (w - 6 * and h + len, len);
Len DrawRec (w - 4 * and h + len, len);
Len DrawRec (w - 2 * and h + len, len);
DrawRec (w, h + len, len);
Len DrawRec (w + 2 * and h + len, len);
Len DrawRec (w + 4 * and h + len, len);

return;
}

Void DrawTri (double x, double y, double z)//in the lower left corner of the origin counterclockwise
{
MovePen (x, y);
Double h=z * SQRT (3)/2;
DrawLine (z, 0);
DrawLine (z/2 h);
DrawLine (z/2 - h);
}

Void DrawRec (double x, double y, double z)//in the upper left corner of the origin clockwise
{
MovePen (x, y);
DrawLine (z, 0);
DrawLine (0, z);
DrawLine (z, 0);
DrawLine (0, z);
}

CodePudding user response:

Scoop out upup himself

CodePudding user response:

It's not devcpp fault? Has something to do with the code?

CodePudding user response:

reference 3 floor is Simple - Soft reply:
not devcpp fault? Has something to do with the code?

Can the detailed ask what is wrong?
  • Related