如何求最大和最小值? (40分)

Y

yourid

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个TStringList型的变量,存有一些正负数,现在想找出其中的最大和最小值,
我用如下方法为什么不可以呢?我该怎么改?
var min,max:Double;
for I:=0 to yvalue.Count-1 do
begin
min:=Min(Strtofloat(yvalue),Strtofloat(yvalue[I+1]));
max:=Max(Strtofloat(yvalue),Strtofloat(yvalue[I+1]));
end;
 
var min,max:Double;
min:=Min(Strtofloat(yvalue[0]),Strtofloat(yvalue[1]));
max:=Max(Strtofloat(yvalue[0]),Strtofloat(yvalue[1]));
for I:=2 to yvalue.Count-1 do
begin
min:=Min(min,Strtofloat(yvalue));
max:=Max(max,Strtofloat(yvalue));
end;
 
TO:番番
Delphi不区分大小写的,你的程序能编译吗?
 
顶部