Спасибо, только у меня теперь сумма минимального и максимального элемента неправильно считается)) вообще хз почему, вроде все четко =(
Код:
procedure TForm1.Button1Click(Sender: TObject);
var a:array of real; i: integer;
max, min, s,sum: real;
begin
Memo1.Lines.Clear;
if OpenDialog1.Execute then
Begin
setlength (a,0);
AssignFile(f,OpenDialog1.FileName);
Reset(f);
i:=0;
while not EOF(f) do
begin
SetLength(a, Length(a)+1);
i:=i+1;
Readln(f,a[high(a)]);
Memo1.Lines.Add(floattostr(a[high(a)]));
end;
end
else
exit;
max:= a[1];
min:= a[1];
s:=a[1];
for i:=1 to high(a) do
begin
if a[i+1] > max then
max:= a[i+1];
end;
for i:=1 to high(a) do
begin
If a[i+1] < min then
min:= a[i+1];
end;
Edit1.Text:= floattostr(max+min);
for i:=1 to high(a) do
begin
if i mod 2 <>0 then
if abs(a[i+1]) > s then
s:= a[i+1];
Edit2.text:=floattostr(s);
end;
SetLength(a, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if SaveDialog1.Execute then Memo1.Lines.SaveToFile(SaveDialog1.FileName);
end;