1-B,1-z
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
end;
type TFigyra = class
a, b:real;
constructor create(x, y:real);
function sq(x1, y1:real): boolean;
function pl(x2, y2:real): real;
end;
mass=array of TFigyra;
var
Form1: TForm1;
implementation
{$R *.dfm}
constructor TFigyra.create(x, y:real);
begin
a:=x;
b:=y;
end;
function TFigyra.sq(x1, y1:real): boolean;
begin
sq:=false;
if x1= y1
then sq:=true;
end;
function TFigyra.pl(x2, y2:real): real;
begin
pl:= x2*y2;
end;
procedure TForm1.Button1Click(Sender: TObject);
var f:textfile; n, k, i:integer;
c1, c2, max:real; aa:mass; bb:array of boolean;
begin
assignfile(f, 'in.txt');
reset(f);
n:=0;
while not eof(f) do
begin
n:=n+1;
setlength(aa, n);
readln(f, c1, c2);
aa[n-1]:= TFigyra.create(c1, c2);
end;
closefile(f);
setlength(bb, n);
k:=0;
for i:=0 to n-1 do
begin
bb[i]:=aa[i].sq(aa[i].a, aa[i].b);
end;
for i:=0 to n-1 do
if bb[i]= true
then inc(k);
edit1.text:=floattostr(k);
max:=aa[0].pl(aa[0].a, aa[0].b);
for i:=2 to n-1 do
if aa[i].pl(aa[0].a, aa[0].b) > max
then max:= aa[i].pl(aa[0].a, aa[0].b);
edit2.Text:= floattostr(max);
end;
end.