variable:X[6]:=0;
X[1]:=OPI01;
X[2]:=OPI03;
X[3]:=OPI05;
X[4]:=OPI07;
X[5]:=OPI09;
X[6]:=OPI11;
for i=1 to 5 do
begin
for j=i+1 to 6 do
begin
if(X[i]<X[j])do
begin
k:=X[i];
X[i]:=X[j];
X[j]:=k;
end;
end;
end;
oh:=X[1];
为何前面的循环取最大值无法成功,而下面的的代码就可以呢?
oh1:=max(OPI01,OPI03);
oh2:=max(OPI05,OPI07);
oh3:=max(oh1,oh2);
oh4:=max(OPI09,OPI11);
oh:=max(oh3,oh4);
OPI01:=STKINDI('C01','基本元素.opi1',0,6,0);
OPI03:=STKINDI('C03','基本元素.opi1',0,6,0);
OPI05:=STKINDI('C05','基本元素.opi1',0,6,0);
OPI07:=STKINDI('C07','基本元素.opi1',0,6,0);
OPI09:=STKINDI('C09','基本元素.opi1',0,6,0);
OPI11:=STKINDI('C11','基本元素.opi1',0,6,0);