Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Kursova.docx
Скачиваний:
10
Добавлен:
23.02.2016
Размер:
3.81 Mб
Скачать

3.4 Блок-схема до підпрограми like

Початок

t1,a дійсного типу

3.2 Блок-схема до підпрограми zah

zah

Початок

очистка екрана

Kyrsova robota

na temy:

"Stvorennja programnoho kompleksy movamu programyvannja Paskal ta Ci"

Vukonav:

stydent grupy KM-125

Kunov Maksym Romanovich

Variant No 7

Очікування натиснення будь-якої клавіші

Кінець

  1. Розробка програм розв‘язання задач мовами програмування паскаль та сі

Паскаль

Сі

uses crt, graph;

type kyk=record

x:real;

y:real;

end;

tik=array[1..7] of kyk;

const mas:array[1..11] of string=('1) Zagolovok.','2) Zavdannja No 1.','2.1. Ymova zavdannja No 1.',

'2.2. Stvorennja faily z tabyljacieju fynkcij.','2.3. Vuvedennja tabyljacij fynkcij na ekran.',

'2.4. Graphik fynkcij.','3) Zavdannja No 2.','3.1. Ymova zavdannja No 2.',

'3.2 Vmist faily.','3.3. Vuvedennja graphichnoho maljunky.','4) Vuhid.');

var w,h3,b,h,h1,gd,i,j,n1,gm:integer;

sh: char; f:text;

mas1:tik;

var f1:text;

l1,l2,maxp,minp,maxs,mins,c,d1,d2,d3,d4,d5,d6,s1,s2,s3,s4,p1,p2,p3,p4:real;

n,t,m,p,a,fi:real;

s,k:string;

var R,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5:integer;

procedure like(f:real; var x1,y1:real);

var t1,c1,z1,k1,l1:real;

begin

t1:=sin(f)/cos(f);

x1:=(2*a)/(1+t1*t1);

y1:=(2*a)/(t1*(1+t1*t1));

end;

procedure poln;

procedure zah;

begin

cleardevice;

setcolor(9);

settextstyle(0,0,2);

outtextxy(200,100,'Kyrsova robota');

settextstyle(0,0,0);

outtextxy(275,125,'na temy:');

outtextxy(70,150,'"Stvorennja programnoho kompleksy movamu programyvannia Paskal ta Ci"');

outtextxy(400,200,'Vukonav:');

outtextxy(400,225,'stydent grupy KM-125');

outtextxy(400,250,'Kunov Maksym Romanovych');

outtextxy(75,300,'Variant No 7');

outtextxy(270,460,'ChDTY 2013');

readln;

poln;

end;

begin

cleardevice;

h:=1;

h1:=1;

settextstyle(0,0,0);

setfillstyle(9,BLUE);

bar(1,1,640,480);

setfillstyle(1,8);

for i:=1 to 11 do begin

setcolor(15);

rectangle(125,i*35+1,490,i*35+26);

bar(126, i*35+2, 489, i*35+25);

setcolor(0);

outtextxy(135, i*35+10, mas[i]);

end;

setfillstyle(1, 0);

bar(126,38,489,60);

setcolor(15);

outtextxy(135,40,mas[1]);

repeat

repeat

sh:=readkey;

until sh in [#72, #80, #13, #27];

case sh of

#72: h:=h-1;

#80: h:=h+1;

end;

if h=12 then h:=1; if h=0 then h:=11;

setfillstyle(1,8); bar(126, h1*35+2, 489, h1*35+25);

setcolor(0); outtextxy(135, h1*35+10, mas[h1]);

setfillstyle(1, 0); bar(126, h*35+2, 489, h*35+25);

setcolor(15); outtextxy(135, h*35+10, mas[h]);

h1:=h;

if (sh=#13) and (mas[h]=mas[1]) then zah;

if (sh=#13) and (mas[h]=mas[3]) then

begin

cleardevice;

setfillstyle(1,0);

setcolor(BLUE);

bar(1,1,640,480);

settextstyle(0,0,2);

outtextxy(200,25,'Zavdannja No 1');

settextstyle(0,0,1);

outtextxy(75,50,'Vukonaty tabyliaciiu parametrychno zadanoi fynkcii (Tsissoida),');

outtextxy(50,75,'zapusatu ii y fail ta vyvestu iogo na ekran. Pobydyvatu i vuvestu');

outtextxy(50,100,'na ekran monitora graphik ciej fynkcij:');

outtextxy(200,125,'x=(2*a)/(1+t^2); y=(2*a)/(t*(1+t^2));');

outtextxy(200,150,'a>0; t=tg(fi); fi e (0;2*pi).');

readln;

poln;

end;

if (sh=#13) and (mas[h]=mas[8]) then

begin

cleardevice;

setfillstyle(1,0);

setcolor(blue);

bar(1,1,640,480);

settextstyle(0,0,2);

outtextxy(200,25,'Zavdannja No 2');

settextstyle(0,0,1);

outtextxy(75,50,'Y faili zadano koordynaty tsentra ta radiysa kola,a takog tochok,');

outtextxy(75,75,'scho legat na koli. Vyvesty na ekran vpysani trykytnyky z naibilshoiu');

outtextxy(75,100,'ta naimenshoiu ploshceiu. Iakscho v kolo vpysanyi kvadrat, to vyvesty');

outtextxy(75,125,'iogo okremym koliorom.');

readln;

poln;

end;

if (sh=#13) and (mas[h]=mas[4]) then

begin

closegraph;

clrscr;

while (a<=0) do

begin

writeln('Vvedit znachenja a:');

write('a=');

readln(a);

if (a<=0) then writeln ('Nevirno! a>0');

end;

assign(f,'tab.txt');

rewrite(f);

writeln(f,' =========================');

writeln(f,' || x || y ||');

writeln(f,' =========================');

w:=0;

fi:=0.1;

for i:=1 to 7 do

with mas1[i] do

begin

like(fi,x,y);

fi:=fi+pi/4;

str(x:3:1,s);

str(y:3:1,k);

b:=55+w;

h3:=60+w;

w:=w+15;

writeln(f,' || '+s+' | '+k+' ||');

writeln(f,' _________________________');

end;

close(f);

readln;

gd:=detect;

initgraph(gd,gm,'c:/fpc/2.6.0/bin/i386-win32');

poln;

end;

if (sh=#13) and (mas[h]=mas[5]) then

begin

cleardevice;

outtextxy(25,25,' =========================');

outtextxy(25,35,' || x || y ||');

outtextxy(25,45,' =========================');

w:=0;

fi:=0.1;

for i:=1 to 7 do

with mas1[i] do

begin

like(fi,x,y);

fi:=fi+pi/4;

str(x:3:1,s);

str(y:3:1,k);

b:=55+w;

h3:=60+w;

w:=w+15;

outtextxy(25,b,' || '+s+' | '+k+' ||');

outtextxy(25,h3,' _________________________ ');

end;

readln;

poln;

end;

if (sh=#13) and (mas[h]=mas[6]) then

begin

cleardevice;

setfillstyle(1,BLUE);

bar(1,1,640,480);

setcolor(BLACK);

line(320,50,320,450);

line(575,240,75,240);

w:=0;

for i:=1 to 11 do

begin

putpixel(320-w,240,0);

putpixel(320+w,240,0);

putpixel(320,240+w,0);

putpixel(320,240-w,0);

w:=w+25;

end;

outtextxy(317,47,#30);

outtextxy(577,237,#16);

outtextxy(300,50,'Y');

outtextxy(585,245,'X');

outtextxy(300,225,'0');

outtextxy(259,248,'-2');

outtextxy(285,248,'-1');

outtextxy(235,248,'-3');

outtextxy(208,248,'-4');

outtextxy(184,248,'-5');

outtextxy(343,248,'1');

outtextxy(367,248,'2');

outtextxy(392,248,'3');

outtextxy(416,248,'4');

outtextxy(442,248,'5');

outtextxy(325,212,'1');

outtextxy(325,187,'2');

outtextxy(325,162,'3');

outtextxy(325,137,'4');

outtextxy(325,112,'5');

outtextxy(325,262,'-1');

outtextxy(325,287,'-2');

outtextxy(325,313,'-3');

outtextxy(325,337,'-4');

outtextxy(325,362,'-5');

fi:=0.1;

for i:=1 to 6 do

begin

like(fi,mas1[i].x,mas1[i].y);

fi:=fi+pi/4;

setlinestyle(0,0,3);

setcolor(0);

line(round(mas1[i].x*25+320),round(-mas1[i].y*25+240),round(mas1[i+1].x*25+320),round(-mas1[i+1].y*25+240));

end;

readln;

poln;

end;

if (sh=#13) and (mas[h]=mas[9]) then

begin

closegraph;

clrscr;

assign(f1,'vvfile.txt');

reset(f1);

read(f1,R);

read(f1,x1);

read(f1,y1);

read(f1,x2);

read(f1,y2);

read(f1,x3);

read(f1,y3);

read(f1,x4);

read(f1,y4);

read(f1,x5);

read(f1,y5);

readln(f1);

close(f1);

writeln ('R-radius kola; Centr - koordynaty centra; A,B,C,D - tochky na koli');

writeln;

writeln('R=',R);

writeln('A(',x1,';',y1,');');

writeln('B(',x2,';',y2,');');

writeln('C(',x3,';',y3,');');

writeln('D(',x4,';',y4,'),');

writeln('Centr(',x5,';',y5,')');

readln;

gd:=detect;

initgraph(gd, gm, 'd:/fpc/2.6.0/bin/i386-win32');

poln;

end;

if (sh=#13) and (mas[h]=mas[10]) then

begin

clrscr;

maxp:=0;

maxs:=0;

mins:=1559;

minp:=1559;

d1:=sqrt(sqr(x1-x3)+sqr(y1-y3));

d2:=sqrt(sqr(x3-x4)+sqr(y3-y4));

d3:=sqrt(sqr(x1-x4)+sqr(y1-y4));

d4:=sqrt(sqr(x2-x4)+sqr(y2-y4));

d5:=sqrt(sqr(x2-x3)+sqr(y2-y3));

d6:=sqrt(sqr(x1-x2)+sqr(y1-y2));

p1:=(d1+d2+d3)/2;

p2:=(d5+d2+d4)/2;

p3:=(d1+d5+d6)/2;

p4:=(d4+d6+d3)/2;

s1:=sqrt(p1*(p1-d1)*(p1-d2)*(p1-d3));

s2:=sqrt(p2*(p2-d5)*(p2-d2)*(p2-d4));

s3:=sqrt(p3*(p3-d1)*(p3-d5)*(p3-d6));

s4:=sqrt(p4*(p4-d4)*(p4-d6)*(p4-d3));

if (s1>maxs) then

begin

maxs:=s1;

end;

if (s1<mins) then

begin

mins:=s1;

end;

if (s2>maxs) then

begin

maxs:=s2;

end;

if (s2<mins) then

begin

mins:=s2;

end;

if (s3>maxs) then

begin

maxs:=s3;

end;

if (s3<mins) then

begin

mins:=s3;

end;

if (s4>maxs) then

begin

maxs:=s4;

end;

if (s4<mins) then

begin

mins:=s4;

end;

if (d1=d2) and (d2=d4) and (d4=d6) then

begin

setcolor(GREEN);

rectangle(x1,y1,x4,y4);

end;

setfillstyle(1,7);

bar(1,1,640,480);

setcolor(4);

setlinestyle(0,0,3);

if maxs=s1 then

begin

circle(320,240,50);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

end;

if maxs=s2 then

begin

circle(320,240,50);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

end;

if maxs=s3 then

begin

circle(320,240,50);

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

end;

if maxs=s4 then

begin

circle(320,240,50);

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

end;

setcolor(0);

if mins=s1 then

begin

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

end;

if mins=s2 then

begin

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

end;

if mins=s3 then

begin

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

end;

if mins=s4 then

begin

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

end;

readln;

poln;

end;

until (sh=#13) and (mas[h]=mas[11]);

end;

begin

clrscr;

gd:=detect;

initgraph(gd, gm, 'd:/fpc/2.6.0/bin/i386-win32');

poln;

closegraph;

end.

#include <dos.h>

#include <conio.h>

#include <stdio.h>

#include <math.h>

#include <stdlib.h>

#define TRUE 1

#define FALSE 0

#include <graphics.h>

float like(float f,float a1,float *x1,float *y1)

{float t1;;

t1=sin(f)/cos(f);

*x1=(2*a1)/(1+t1*t1);

*y1=(2*a1)/(t1*(1+t1*t1));

return (*x1,*y1);}

void zavd2()

{clrscr();

_setcursortype(0);

gotoxy(27,5);

printf("Zavdannja No 2");

gotoxy(10,9);

printf("U faili zadano koordynaty tsentra ta radiusa kola, a takog tochok");

gotoxy(10,10);

printf("scho legat na koli. Vyvesty na ekran vpysani trykytnyky z naibilshoiu");

gotoxy(10,11);

printf("ta naimenshoiu ploscheiu. Iakscho v kolo vpysanyj kvadrat, to vyvesty,");

gotoxy(10,12);

printf("iogo okremym koliorom.");

getch();}

void zavd1()

{clrscr();

_setcursortype(0);

gotoxy(30,2);

printf("Zavdanniaя No 1");

gotoxy(10,5);

printf("Vykonaty tabyliaciio parametrychno zadanoi funkcii (Tsissoida),");

gotoxy(7,6);

printf("zapysaty ii u fail ta vyvesty iogo na ekran. Pobuduvaty i vyvesty");

gotoxy(7,7);

printf("na ekran monitora graphik tsiei funkcii:");

gotoxy(25,9);

printf("x=(2*a)/(1+t^2); y=(2*a)/(t*(1+t^2));");

gotoxy(25,10);

printf("a>0; t=tg(fi); fi e (0;2*pi).");

getch();}

void zah()

{clrscr();

_setcursortype(0);

gotoxy(30,5);

printf("Kursova robota");

gotoxy(33,6);

printf("na temu:");

gotoxy(9,8);

printf("'Stvorennia programnogo kompleksu movamy Pascal ta Ci'");

gotoxy(52,11);

printf("Vykonav:");

gotoxy(52,12);

printf("student grupy KM-125");

gotoxy(52,13);

printf("Kunov Maksym Romanovych");

gotoxy(10,17);

printf("Variant No 7");

gotoxy(32,25);

printf("ChDTU 2013");

getch();}

void frame(int x1,int y1,int x2,int y2)

{int i,j;

int A=186,B=187,C=188,D=200,E=201,F=205;

gotoxy(x1,y1);

printf("%c",E);

for (i=(x1+1);i<=(x2-1);i++) printf("%c",F);

printf("%c",B);

for (i=(y1+1);i<=(y2-1);i++)

{gotoxy(x1,i);

printf("%c",A);

gotoxy(x2,i);

printf("%c",A);}

gotoxy(x1,y2);

printf("%c",D);

for (i=(x1+1);i<=(x2-1);i++) printf("%c",F);

printf("%c",C);}

int gmenu(int y1,int *regime)

{typedef unsigned short bool;

int key,result,k1=0, kr=11,i,r;

struct rak{

char ptr[50];};

struct rak m[11]={"1)","2)","2.1.","2.2.","2.3.","2.4.","3)","3.1.","3.2.","3.3.","4)"};

int pp[11];

bool fl;

clrscr();

fl=TRUE;

r=0;

for(i=0;i<=10;i++) r=r+sizeof(m[i].ptr);

r=ceil((78-r)/kr)-1;

frame(3,y1-1,75,y1+1);

gotoxy(6,5);

gotoxy(ceil(r/2+3),y1);

for (i=0;i<=10;i++)

{pp[i]=wherex();

printf("%s",m[i].ptr);

if (i==10) r=0;

printf(" ");}

gotoxy(10,10);

printf("1) Zagolovok.");

gotoxy(10,11);

printf("2) Zavdanniaя No 1.");

gotoxy(10,12);

printf("2.1. Umova zavdanniaя No 1.");

gotoxy(10,13);

printf("2.2. Stvorennia failu z tabuliacieiu funkcii.");

gotoxy(10,14);

printf("2.3. Vyvedennia tabuliacii funkcii na ekran.");

gotoxy(10,15);

printf("2.4. Grafik funkcii .");

gotoxy(10,16);

printf("3) Zavdannia No 2.");

gotoxy(10,17);

printf("3.1. Umova zavdannia No 2.");

gotoxy(10,18);

printf("3.2. Vmist failu.");

gotoxy(10,19);

printf("3.3. Vyvedennia grafichnogo maliunku,");

gotoxy(10,20);

printf("4) Vyhid.");

_setcursortype(0);

i=0;

while (fl==TRUE)

{key=getch();

if (key==13) fl=FALSE;

if (key==0 && kbhit()) {key=getch();

switch (key){

case 77: _setcursortype(1);

gotoxy(k1+pp[i],y1);

printf("%s",m[i].ptr);

i=i+1;

if (i==11) {i=0;

gotoxy(k1+pp[i],y1);

printf("%s",m[i].ptr);

goto met;}

gotoxy(k1+pp[i],y1);

printf("%s",m[i].ptr);break;

case 75:_setcursortype(1);

gotoxy(k1+pp[i],y1);

printf("%s",m[i].ptr);

i=i-1;

if (i==(k1-1)) i=10;

gotoxy(k1+pp[i],y1);

printf("%s",m[i].ptr);break;}

met:}}

_setcursortype(2);

*regime=i;

return (*regime);}

void main(){

struct kyk{

float x;

float y;};

struct kyk mas1[7];

int R,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,w,h3,b,i,rez;

float t,m,n,p,a,fi,pi=3.14;

char s[10],k[10];

FILE *file;

int d=VGA, m1=VGAHI;

FILE *file1;

int xa,ya,xb,yb,xc,yc,xd,yd,j,n1;

float l1,l2,maxs,mins,c,d1,d2,d3,d4,d5,d6,p1,p2,p3,p4,s1,s2,s3,s4;

clrscr();

mks:gmenu(5,&rez);

if (rez==0) {zah();goto mks;}

if (rez==1) goto mks;

if (rez==2) {zavd1();goto mks;}

if (rez==3) { clrscr();

pl: printf("Vvedit a:");

printf("\na=");

scanf("%f",&a);

if(a<=0) {printf("Nevirno! a>0\n"); goto pl;}

getch();goto mks;}

if (rez==4) {initgraph (&d,&m1,"c:\\borlandc\\bgi");

printf("\n ========================");

printf("\n || x || y ||");

printf("\n ========================");

file=fopen("tab.txt","w");

fprintf(file," ========================");

fprintf(file,"\n || x || y ||");

fprintf(file,"\n ========================");

fi=0.1;

for (i=0;i<=6;i++)

{

like(fi,a,&mas1[i].x,&mas1[i].y);

printf("\n || %.1f | %.1f ||",mas1[i].x,mas1[i].y);

printf("\n ________________________ ");

fprintf(file,"\n || %.1f | %.1f ||",mas1[i].x,mas1[i].y);

fprintf(file,"\n ________________________");

fi=fi+pi/4;}

fclose(file);getch(); closegraph();goto mks;}

if (rez==5) {initgraph (&d,&m1,"c:\\borlandc\\bgi");

setfillstyle(1,1);

bar(1,1,640,480);

setcolor(0);

line(320,50,320,450);

line(575,240,75,240);

w=0;

for (i=0;i<=10;i++)

{putpixel(320-w,240,0);

putpixel(320+w,240,0);

putpixel(320,240+w,0);

putpixel(320,240-w,0);

w=w+25;}

outtextxy(317,47,"^");

outtextxy(573,237,">");

outtextxy(300,50,"Y");

outtextxy(585,245,"X");

outtextxy(300,225,"0");

outtextxy(259,248,"-2");

outtextxy(285,248,"-1");

outtextxy(235,248,"-3");

outtextxy(208,248,"-4");

outtextxy(184,248,"-5");

outtextxy(343,248,"1");

outtextxy(367,248,"2");

outtextxy(392,248,"3");

outtextxy(416,248,"4");

outtextxy(442,248,"5");

outtextxy(325,212,"1");

outtextxy(325,187,"2");

outtextxy(325,162,"3");

outtextxy(325,137,"4");

outtextxy(325,112,"5");

outtextxy(325,262,"-1");

outtextxy(325,287,"-2");

outtextxy(325,313,"-3");

outtextxy(325,337,"-4");

outtextxy(325,362,"-5");

fi=0.1;

for (i=0;i<=5;i++)

{like(fi,a,&mas1[i].x,&mas1[i].y);

setlinestyle(0,0,3);

setcolor(0);

line(ceil(mas1[i].x*25+320),ceil(-mas1[i].y*25+240),ceil(mas1[i+1].x*25+320),ceil(-mas1[i+1].y*25+240));

fi=fi+pi/4;}

getch();

closegraph();goto mks;}

if (rez==6) goto mks;

if (rez==7) {zavd2();goto mks;}

if (rez==8) {clrscr();

file1=fopen("vvfile.txt","r");

fscanf(file1,"%d",&R);

fscanf(file1,"%d",&x1);

fscanf(file1,"%d",&y1);

fscanf(file1,"%d",&x2);

fscanf(file1,"%d",&y2);

fscanf(file1,"%d",&x3);

fscanf(file1,"%d",&y3);

fscanf(file1,"%d",&x4);

fscanf(file1,"%d",&y4);

fscanf(file1,"%d",&x5);

fscanf(file1,"%d",&y5);

_setcursortype(0);

printf("\nR-radius kola; Centr-koordynaty centra; A,B,C,D-tochky na koli");

printf("\nR=%d",R);

printf("\nA=(%d;%d);",x1,y1);

printf("\nB=(%d;%d);",x2,y2);

printf("\nC=(%d;%d);",x3,y3);

printf("\nD=(%d;%d);",x4,y4);

printf("\nCentr=(%d;%d);",x5,y5);

getch();goto mks;}

if (rez==9) {initgraph (&d,&m1,"c:\\borlandc\\bgi");

maxs=0;

mins=1559;

d1=sqrt(pow((x1-x3),2)+pow((y1-y3),2));

d2=sqrt(pow((x3-x4),2)+pow((y3-y4),2));

d3=sqrt(pow((x1-x4),2)+pow((y1-y4),2));

d4=sqrt(pow((x2-x4),2)+pow((y2-y4),2));

d5=sqrt(pow((x2-x3),2)+pow((y2-y3),2));

d6=sqrt(pow((x1-x2),2)+pow((y1-y2),2));

p1=(d1+d2+d3)/2;

p2=(d5+d2+d4)/2;

p3=(d1+d5+d6)/2;

p4=(d4+d6+d3)/2;

s1=sqrt(p1*(p1-d1)*(p1-d2)*(p1-d3));

s2=sqrt(p2*(p2-d5)*(p2-d2)*(p2-d4));

s3=sqrt(p3*(p3-d1)*(p3-d5)*(p3-d6));

s4=sqrt(p4*(p4-d4)*(p4-d6)*(p4-d3));

if (s1>maxs)

maxs=s1;

if (s1<mins)

mins=s1;

if (s2>maxs)

maxs=s2;

if (s2<mins)

mins=s2;

if (s3>maxs)

maxs=s3;

if (s3<mins)

mins=s3;

if (s4>maxs)

maxs=s4;

if (s4<mins)

mins=s4;

setfillstyle(1,7);

bar(1,1,640,480);

setcolor(RED);

setlinestyle(0,0,3);

if (maxs==s1)

{

circle(320,240,50);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

}

if (maxs==s2)

{

circle(320,240,50);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

}

if (maxs==s3)

{

circle(320,240,50);

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

}

if (maxs==s4)

{

circle(320,240,50);

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

}

setcolor(BLACK);

if (mins==s1)

{

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

}

if (mins==s2)

{

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x3*10+320,y3*10+240,x4*10+320,y4*10+240);

}

if (mins==s3)

{

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x1*10+320,y1*10+240,x3*10+320,y3*10+240);

line(x2*10+320,y2*10+240,x3*10+320,y3*10+240);

}

if (mins==s4)

{

line(x1*10+320,y1*10+240,x2*10+320,y2*10+240);

line(x2*10+320,y2*10+240,x4*10+320,y4*10+240);

line(x1*10+320,y1*10+240,x4*10+320,y4*10+240);

}

if (d1==d2==d4==d6)

{

setcolor(2);

rectangle(x1,y1,x4,y4);

}

fclose(file1);

getch();

closegraph();goto mks;}

if (rez==10) _setcursortype(0);

getch();

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]