Hallo,
ich will zwei Einträge eines Arrays vertauschen und habe dazu folgende Prozedur geschrieben:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
| procedure TForm1.ExchangePositionsInArray(InputArray : TMyArray; Index1,Index2 : integer); begin if (Index1<High(InputArray)) and (Index2<High(InputArray)) then begin SetLength(InputArray,Length(InputArray)+1); InputArray[High(InputArray)]:=InputArray[Index2]; InputArray[Index2]:=InputArray[Index1]; InputArray[Index1]:=InputArray[High(InputArray)]; SetLength(InputArray,Length(InputArray)-1); end; end; |
Nur leider funktioniert das nicht, sprich, ese tut sich nichts.
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot