procedure TForm1.Button1Click(Sender: TObject);
Var x11,y11,x12,y12,x13,y13:real;
x21,y21,x22,y22,x23,y23:real;
S1,S2:real;
Flag:Boolean;
Function Len (a,b,c,d:real):real;
Begin
Len:=sqrt(sqr(a-b)+sqr(c-d));
End;
Function Input(var x1,y1,x2,y2,x3,y3:real):boolean;
Var a,b,c:real;
Begin
a:=Len(x1,y1,x2,y2);
b:=Len(x1,y1,x3,y3);
c:=Len(x3,y3,x2,y2);
if (a>=b+c) or (c>=a+b) or (b>=a+c)then
label17.Caption:='Помилка! Повторіть введення:'
else
Begin
Function P(x,y,z:real):real;
Begin
P:=x+y+z;
End;
Function S(a,b,c:real):real;
Var PP:real;
Begin
PP:=P(x,y,z)/2;
S:=sqrt(PP*(PP-a)*(PP-b)*(PP-c));
End;
End;
End;
begin
x11:=Strtofloat(edit1.Text);
x12:=Strtofloat(edit2.Text);
x13:=Strtofloat(edit3.Text);
y11:=Strtofloat(edit4.Text);
y12:=Strtofloat(edit5.Text);
y13:=Strtofloat(edit6.Text);
x21:=Strtofloat(edit7.Text);
x22:=Strtofloat(edit8.Text);
x23:=Strtofloat(edit9.Text);
y21:=Strtofloat(edit10.Text);
y22:=Strtofloat(edit11.Text);
y23:=Strtofloat(edit12.Text);
repeat
Flag:=Input(x11,y11,x12,y12,x13,y13);
until Flag;
repeat
Flag:=Input(x21,y21,x22,y22,x23,y23);
until Flag;
S1:=S(x11,y11,x12,y12,x13,y13);
S2:=S(x21,y21,x22,y22,x23,y23);
Procedure Output(S1,S1:real);
Begin
if S1>S2
then
begin
Label17.caption:='Більшу площу має перший трикутник.';
Label18.Caption:='Його площа дорівнює -> '+floattostr(s1);
end
else
if S2>S1
then
begin
Label17.caption:='Більшу площу має другий трикутник.';
Label18.Caption:='Його площа дорівнює -> '+floattostr(s2);
end
else
begin
Label17.caption:='Трикутники мають однакову площу.';
Label18.Caption:=' площа дорівнює -> '+floattostr(s1);
end;
End;