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

                   detectgraph( &gd , &gm ) ;

                   initgraph ( &gd , &gm , "" ) ;

                   error = graphresult() ;

                  if ( error != grOk )

                                     {

                                      puts ("ERROR :\n ") ;

                                      puts ( grapherrormsg ( error ) ) ;

                                      exit (1) ;

                                     }

                   else

                                     {

                   if (a==1)

                               {

                                     int v,n;

                                     v = St_E ;n = Co_R;

                                     setcolor(Line_Light);

                                     setlinestyle(Line_Tip,0,1);

                                     setfillstyle (v,n) ;

                                     fillpoly ( 4 , MAS ) ;

                                     printf("VNESHNYAYA TRAPECIYA") ;

                               }

                        if (a==2)

                               {

                                    setcolor(Line_Light1);

                                    setlinestyle(Line_Tip1,0,1);

                                    setfillstyle (St_E1,Co_R1) ;

                                    fillpoly ( 4 , MAS1 ) ;

                                    printf("VNUTRENNYAYA TRAPECIYA") ;

                               }

                        }

                  getch();

                  closegraph();

                 }

     void paint_F_v_F ()//рисование фигуры в фигуре

                 {

                   clrscr();

                   int gd , gm , error ;

                   detectgraph( &gd , &gm ) ;

                   initgraph ( &gd , &gm , "" ) ;

                   error = graphresult() ;

                   if ( error != grOk )

                                     {

                                      puts ("ERROR :\n ") ;

                                      puts ( grapherrormsg ( error ) ) ;

                                      exit (1) ;

                                     }

                        else

                                     {

                                       setcolor(Line_Light);

                                       setlinestyle(Line_Tip,0,1);

                                       setfillstyle (St_E,Co_R) ;

                                       fillpoly ( 4 , MAS ) ;

                                       int j = getpixel(639,479);

                                       setcolor(j);

                                       setlinestyle(1,0,1);

                                       setfillstyle (1,j) ;

                                       fillpoly ( 4 , MAS1 ) ;

                   printf("TRAPECIYA v TRAPECII") ;

                  }

                  getch();

                  closegraph();

                 }

  1. Набор тестов :

1.4точки лежат на одной прямой

200 200

300 200

400 200

500 200

400 100

500 100

400 300

300 300

2.3точки лежат на одной прямой

200 200

300 200

500 200

300 400

400 100

500 100

400 300

300 300

       3.Фигуры не вложены

100 100

500 300

500 400

100 400

400 100

500 100

400 300

300 300

4.не в экране

100 100

800 300

800 400

100 400

400 100

500 500

400 700

300 300

      5.не параллельные стороны

100 100

500 300

500 300

100 400

200 200

400 200

400 300

200 300

     6.все хорошо

100 100

500 200

500 300

100 400

200 200

400 200

400 300

200 300