Разработка функций, рисующих на экране геометрические фигуры (параллелограммы) (Лабораторная работа № 1), страница 5

                                                                       scanf ("%d", &FillColour);

                                                                       break;

                                    }

                  }

                  while (v!=0);

}

int menu ()

{

                  int v;

                  printf ("By Malev Kirill PM-71\n\n\n");

                  printf ("This thing was created to draw some figure o_O\n\n\n");

                  printf ("Menu:\n");

                  printf ("1)Parallelogramm\n");

                  printf ("2)Filled parallelogramm\n");

                  printf ("3)One figure in other\n");

                  printf ("\n\n\n4) Options\n");

                  printf ("\n\n\n0) Exit\n");

                  scanf ("%d",&v);

                  switch (v)

                  {

                                    case 1: how();

                                                     Draw (yExt,xExt);

            getch();

                                                     break;

                                    case 2: how();

                                                     DrawFill (yExt,xExt);

                                                     break;

                                    case 3: onein ();

                                                     DrawFill (yExt,xExt);

            FillColour=0;

            LineColour=0;

                                                     DrawFill (yIn,xIn);

                                                     break;

                                    case 4: options ();break;

                                    //case 0: exit(1);break;

                                    default: break;

                  }

                  return (v);

}

void SetDefault ()

{

    FillStyle=1;

    FillColour=15;

    LineColour=15;

    LineStyle=1;

}

void main()

{

                  int ex;

    SetDefault();

                  int gdriver = DETECT, gmode, errorcode;

                  initgraph(&gdriver, &gmode, "C:\\bc\\bgi");

                  errorcode = graphresult();

                  if (errorcode != grOk)

                  {

                                    printf("Graphics error: %s\n", grapherrormsg(errorcode));

                                    printf("Press any key to halt:");

                                    getch();

                                    exit(1);

                  }

                  do

                  {

                                    //clrscr();

                                    ex=menu();

                  }

                  while (ex!=0);

                  /*for (int i=1;i<5;i++)

                  {

                                    printf ("\n%d %d\n",xExt[i],yExt[i]);

                  }*/

                  //par(yExt,xExt);

                  closegraph();

}

4. Набортестов

Введенные данные:

координаты x,y; длины диагоналей горизонтальной и вертикальной; угол наклона ромба по часовой стрелке

Результат

1

 320 240 30 15 30

Пустой ромб, с углом наклона 30˚

2

250 300 20 10 5

Закрашенный ромб,

с углом наклона 5˚

3

320 240 30 20 10

320 240 10 5 10

Два вложенных ромба

4

10 10 30 15 0

Ромб, вышедший за границу экрана, и сообщение об ошибке

5

320 240 30 20 0

320 240 30 10 45

Два невложенных ромба и сообщение об ошибке