function GetArrNum(Value: Integer): Integer;
var
i: Integer;
begin
Result := 0;
for i := Low(MyArr) to High(MyArr) do
begin
if MyArr[i].TmpLen = Value then
begin
Result := i;
Break;
end;
end;
end;
for i := Low(MyArr) to High(MyArr) do
begin
MyForm.MeMo3.Lines.Add(inttostr(MyArr[i].TmpLen) + 'A:' + inttostr(MyArr[GetArrNum(MyArr[i].TmpLen)].a)); //输出信息
end;
for i:=1 to N-1 do //N 是数组长度
for j:=N downto i+1 do
begin
if myArr[j].tmpLen < myArr[i].tmpLen then
begin //数组全部交换
temp.tmpLen:=myArr[i].tmplen
temp.a :=myArr[i].a;
myArr[j].tmplen :=temp.tmpLen;
myArr[j].a; :=temp.a;
end;
end;
for i:=1 to N do
Myform3.memo3.Lines.add('MyArr['+inttostr(i)+'].TmpLen:='+inttostr(myArr[i].tmpLen) + 'MyArr['+inttostr(i)+'].a:='+inttostr(myArr[i].a));