procedure TForm1.DoSort1Click(Sender: TObject);
var
i : integer; //Zähler
max : integer; //Maximale Zahlenanzahl
zs : real; //Zwischenspeicher für ne Zahl
Feld : array [0..9] of real;
j: integer;
x, y : integer; //Zähler für GidAusgabe
begin
y := 0;
max := 9;
for i := 0 to max do
sorted.Items.Delete(0);
for i := 0 to change.RowCount do
change.RowCount := change.RowCount - 1;
for i := 0 to max do
Feld[i] := StrToInt(unsorted.Items.Strings[i]);
for x := 0 to 9 do
change.Cells[x,y] := FloatToStr(Feld[x]);
change.RowCount := change.RowCount+1;
inc(y);
for i := 1 to max do
begin
zs := Feld[i];
j := i-1;
while (zs < Feld[j]) and (j >= 0) do
begin
Feld[j+1] := Feld[j];
dec(j);
for x := 0 to 9 do
change.Cells[x,y] := FloatToStr(Feld[x]);
change.RowCount := change.RowCount+1;
inc (y);
end;
Feld[j+1] := zs;
end;
for i := 0 to max do
sorted.Items.Add(FloatToStr(Feld[i]));
change.RowCount := change.RowCount - 1;
counter.Text := inttostr(change.RowCount);
end;
procedure TForm1.Hinzufuegen1Click(Sender: TObject);
begin
unsorted.items.add(edit1.text);
unsorted.items.add(edit2.text);
unsorted.items.add(edit3.text);
unsorted.items.add(edit4.text);
unsorted.items.add(edit5.text);
unsorted.items.add(edit6.text);
unsorted.items.add(edit7.text);
unsorted.items.add(edit8.text);
unsorted.items.add(edit9.text);
unsorted.items.add(edit10.text);
end;