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

                                     {

                                      puts ("ERROR : ") ;

                                      puts ( grapherrormsg ( error ) ) ;

                                      exit (1) ;

                                      return 2 ;

                                     }

                          else

                                     {

                                       int f = 1 , a , b ;

                                       a = getpixel (1,1) ;

                                       b = sqrt( pow(a-1,2) ) ;

                                       setfillstyle (1,b) ;

                                       fillpoly (4,MAS) ;

                                       for ( int i = 0 ; i < 8 && f == 1 ; i = i + 2 )

                                           {

                                                int j ;

                                                j = getpixel(MAS1[i],MAS1[i+1]) ;

                                                if ( j != b ) f = 0 ;

                                           }

                                         closegraph();

                                         return f ;

                                     }

                        }

int Find_Errors_D ( int MAS[] )//проверка на попадание в экран

                            {

                              if(

                                     MAS[0]>=0&&MAS[0]<640&&

                                     MAS[2]>=0&&MAS[2]<640&&

                                     MAS[4]>=0&&MAS[4]<640&&

                                     MAS[6]>=0&&MAS[6]<640&&

                                     MAS[1]>=0&&MAS[1]<480&&

                                     MAS[3]>=0&&MAS[3]<480&&

                                     MAS[5]>=0&&MAS[5]<480&&

                                     MAS[7]>=0&&MAS[7]<480

                                                                        )

                                                                          return 1;

                              else return 0;

                            }

int Find_Errors_Display ()//проверка на попадание в экран й_х трапеций

                                           //одновременно

                            {

                               if ( Find_Errors_D(MAS) && Find_Errors_D(MAS1) )

                               return 1 ;

                               else return 0 ;

                            }

int Find_Errors ( int MAS[] )//проверка на то,что заданная фигура - трапеция

                                     {

                                       int a=Find_Error_Road(MAS),b=Find_Error_Parallel(MAS);

                                       if ( a&&b ) return 1 ;

                                       else return 0 ;

                                     }

int Find_Errors_Phigura ( )//проверка на вложенность фигур и на то,что они

                                            //являются трапециями

                                    {

                                      if ( Vlojennost (MAS,MAS1) == 2 )

                                          return 2 ;

                                      if (

                                           Find_Errors(MAS) && Find_Errors(MAS1) &&

                                           Vlojennost (MAS,MAS1)

                                                                                                           )