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

case 2: perror ("Lines are not parallel (Code 2)"); break;

case 3: perror ("Points are beyond screen (Code 3)"); break;

default: break;

} */

printf ("\nPress any key to continue\n\n");

getch();

}

//Ввод координат Параллелограмма

void where (int y[],int x[])

{

int check_res=0;

while (check_res!=1)

{

clrscr();

printf ("\nPlease input coordinates for parallelogramm:\n\n\n");

printf ("\nLeft bottom point:\n");

scanf ("%d %d",&x[1], &y[1]);

printf ("\nLeft top point:\n");

scanf ("%d %d",&x[2], &y[2]);

printf ("\nRight top point:\n");

scanf ("%d %d",&x[3], &y[3]);

printf ("\nRight bottom point:\n");

scanf ("%d %d",&x[4], &y[4]);

check_res=check(y,x);

if (check_res==0) incdatamsg();

}

}

//Obtaining data from the file.

int where2 (FILE *fp,int y[],int x[])

{

int check_res=0;

fscanf (fp,"%d %d",&x[1], &y[1]);

fscanf (fp,"%d %d",&x[2], &y[2]);

fscanf (fp,"%d %d",&x[3], &y[3]);

fscanf (fp,"%d %d",&x[4], &y[4]);

check_res=check(y,x);

if (check_res==0) incdatamsg();

return (check_res);

}

//Obtaining data from the file

int whereIn (FILE *fp)

{

int check_res=0,check_res2=0;

fscanf (fp,"%d %d",&xExt[1], &yExt[1]);

fscanf (fp,"%d %d",&xExt[2], &yExt[2]);

fscanf (fp,"%d %d",&xExt[3], &yExt[3]);

fscanf (fp,"%d %d",&xExt[4], &yExt[4]);

fscanf (fp,"%d %d",&xIn[1], &yIn[1]);

fscanf (fp,"%d %d",&xIn[2], &yIn[2]);

fscanf (fp,"%d %d",&xIn[3], &yIn[3]);

fscanf (fp,"%d %d",&xIn[4], &yIn[4]);

check_res=check(yExt,xExt);

check_res2=check(yIn,xIn);

if ((check_res==0)||(check_res2==0)) incdatamsg();

return (check_res);

}

void Draw (int *y,int *x)

{

setcolor (LineColour);

par (y,x);

getch();

}

void DrawFill (int *y,int *x)

{

int x1,y1;

x1=((x[4]+x[1])/2);

y1=((y[2]+y[1])/2);

setlinestyle (0,2,1);

setfillstyle (FillColour,FillStyle);

Draw (y,x);

floodfill (x1,y1,LineColour);

setlinestyle (LineStyle,0,LineTough);

Draw (y,x);

}

void onein ()

{

int ans;

printf ("\nType 1 to take data from C://OneIn.txt\n");

scanf ("%d",&ans);

if (ans==1)

{

FILE *fp;