delphi求数组最大\最小值


本文整理自网络,侵删。

 

//求最大值
function GetMaxInArray(A: array of Integer): Integer;
var
  I: Integer;
  tmpMax: Integer;
begin
  tmpMax := A[0];

  for I := low(A) to High(A) do
  begin
    if A[I] > tmpMax then tmpMax := A[I];
  end;

  Result := tmpMax;
end;

//求最小值
function GetMinInArray(A: array of Integer): Integer;
var
  I: Integer;
  tmpMin: Integer;
begin
  tmpMin := A[0];

  for I := low(A) to High(A) do
  begin
    if A[I] < tmpMin then tmpMin := A[I];
  end;

  Result := tmpMin;

end;

相关阅读 >>

Delphi2010下安装控件Delphi

unigui js操作Delphi控件赋值

Delphi获取桌面图标

Delphi统计字数(汉字+字母+符号)

Delphi 在tunimemo中复制和粘贴选定的文本

Delphi adoquery1 update更新数据

Delphi format 另类用法

Delphi fmx 截图

Delphi响应wmi事件(响应网线断开)

dededl安卓中保持屏幕常亮

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...