Ultimate Pack

Find min/max value of array - Mathematics - Tips & Tricks - Greatis Delphi Pages

Use Find_Max and Find_Min procedures, if you want to get maximum or minimum value from array, which contains 10 numbers.

function Find_Max(Arr: array of Integer): Integer;
var
  i, M: Integer;
begin
  M:=Arr[Low(Arr)];
  for i:=1 to High(Arr) do
    if Arr[i]>M then M:=Arr[i];
  Result:=M;
end;

function Find_Min(Arr: array of Integer): Integer;
var
  i, M: Integer;
begin
  M:=Arr[Low(Arr)];
  for i:=1 to High(Arr) do
    if Arr[i]<M then M:=Arr[i];
  Result:=M;
end;
For more
Delphi Help

Download source


Delphi books recommended by Amazon.com

More Delphi programming books on Amazon.com


Copyright © 1998-2014 Greatis Software