type
mass1 =
array
[
1..3
]
of
real
;
mass2 =
array
[
1..4
]
of
real
;
mass3 =
array
[
1..5
]
of
real
;
var
Form1: TForm1;
c,d,p,dis,x1,x2,max:
real
;
i,j:
integer
;
function
max1 (j:
integer
; p:
real
; w:
array
of
real
) :
real
;
procedure
max2 (j:
integer
; d:
real
; y:
array
of
real
);
procedure
max3 (j:
integer
; c:
real
; z:
array
of
real
);
const
w: mass1 = (
2.1
,
3.8
,
0.1
);
y: mass2 = (
0.5
,
4.8
,
5.1
,-
1.5
);
z: mass3 = (
1.5
,
1.8
,
3.4
,
0.2
,
2.85
);
implementation
{$R *.dfm}
procedure
TForm1
.
Button1Click(Sender: TObject);
begin
max1(j,p,w);
max2(j,d,y);
max3(j,c,z);
dis:=d*d-
4
*p*c;
x1:=-d+sqrt(dis)/
2
*p;
x2:=-d-sqrt(dis)/
2
*p;
label2
.
caption:=
'X1='
+floattostr(x1);
label3
.
caption:=
'X2='
+floattostr(x2);
label4
.
caption:=floattostr(p);
label5
.
caption:=floattostr(d);
label6
.
caption:=floattostr(c);
end
;
function
max1 (j:
integer
; p:
real
; w:
array
of
real
) :
real
;
begin
p:=-
999999
;
for
j:=
1
to
3
do
begin
if
w[j]>p
then
p:=w[j];
end
;
end
;
procedure
max2 (j:
integer
; d:
real
; y:
array
of
real
);
begin
d:=-
999999
;
for
j:=
1
to
4
do
begin
if
y[j]>d
then
d:=y[j];
end
;
end
;
procedure
max3 (j:
integer
; c:
real
; z:
array
of
real
);
begin
c:=-
999999
;
for
j:=
1
to
5
do
begin
if
z[j]>c
then
c:=z[j];
end
;
end
;
end
.