Einzelnen Beitrag anzeigen

Technikus

Registriert seit: 2. Aug 2005
46 Beiträge
 
#3

Re: Sortieren von Zufallszahlen im Stringgrid

  Alt 24. Sep 2005, 20:24
Hallo alzaimar,

Ich habs mal probiert und in folgendes geändert:
Delphi-Quellcode:
procedure TForm1.Button2_BubblesortClick(Sender: TObject);
var
 j,ende,i,n,Merke: integer;
begin
  j:= StrToInt (StringGrid1.Cells[2,j]);
  n:=5;
 with StringGrid1 do
 begin
  for i:= ende-1 downto 1 do
   for j:= 1 to i do
    if Stringgrid1.Cells[2,j]> StringGrid1.Cells[2,j+1] then
      begin
       Merke:= StrToInt(StringGrid1.Cells[2,j]);
       Stringgrid1.Cells[2,j]:= StringGrid1.Cells[2,j+1];
       StringGrid1.Cells[2,j+1]:= IntToStr(Merke);
      end;
    StringGrid1.Cells[2,i]:= (StringGrid1.Cells[2,j+1]);
  end
end;
ich hoffe, das begin und end habe ich richtig gesetzt
Der wurm ist aber noch drin.
Gruß Technikus
  Mit Zitat antworten Zitat