请问:怎样才能获得一个数字集合中的最大值和最小值,最好是函数!
解决方案 »
- 应届毕业生求delphi工作
- 如何实现当有新邮件时主界面及时提醒??----------------在线等!
- Twebbrowser控件做简单的浏览器时遇到问题,高手进来指点呀!!
- 求统一码(unicode)的简繁体互换函数~
- 如何屏蔽向程序发送的WM_CHAR WM_IME_CHAR
- TmenuItem不是是组件,如果是请问下在那一页,一有结果马上结贴
- 有关题库管理的问题,即如何合并题目,如何组卷!
- 超时过期的问题
- 五子棋局域网对战版试用版,源代码提供,欢迎下载测试
- 请问大家,到那里有 Sql 7.0 或者SQL 2000下载呢??
- 请问,C++里的数组指针在DELPHI中如何使用?
- 关于多线程的问题
i:integer;
begin
m:=[5,2,3];
for i:=1 to 5 do
if (i in m) then
begin
showmessage('min='+inttostr(i));
break;
end;
for i:=5 downto 1 do
if (i in m ) then
begin
showmessage('max='+inttostr(i));
break;
end;
end;
var
m:array[1..5]of Integer;
i,max,min:Integer;
begin
for i:=1 to 5 do
begin
Randomize;
m[i]:=Random(i*100);
end;
max:=m[1];
min:=m[1];
for i:=2 to 5 do
begin
if max<m[i] then max:=m[i];
if min>m[i] then min:=m[i];
end;
ShowMessage('Max='+IntToStr(max)+',Min='+IntToStr(min));
end;
MaxIntValue(Const Date : array of integer):Integer;//返回一个整数范围的最大的有符号值。
MinIntValue(Const Date : array of Double):Integer;//返回一个整数数组中最小的有符号的数。
MaxValue(Const Date : array of Double):Double;//返回在Date数组中最大的有符号值。
MinValue(Const Date : array of Double):Integer;//返回一个数组中最小的有符号的数。
in 吧
var
m:set of 1..5;
max,min:integer;
begin
m:=[5,2,3];
min:=1;
max:=5;
while not (min in m) do inc(min);
while not (max in m) do dec(max);
showmessage('max='+inttostr(max)+' min='+inttostr(min));
end;
数组:MaxValue