Autor Beitrag
der auenländer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

WIN XP
Delphi 6 PE
BeitragVerfasst: Fr 11.05.07 16:06 
tach zusammen,
ich hab nen bubblesort geschrieben gehabt, aber irgendwie klappt der nich so ganz wie ichs will, wär super nett, wenn mal kurz einer drüber schauen könnt, wo nen fehler steckt. also der compiler meckert nicht mehr aber der sortiert trotzddem nich richtig.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure tForm1.bubblesort( var Feld:TFeld);
var i, j : integer;
    fertig : boolean;
begin
  j:=1;
  repeat
    Fertig:=true;
    for i:=1 to Anzahl-j do
    begin
      if Feld[i] > Feld[i+1then
      begin
        tausche (Feld[i], Feld[i+1]);
        fertig:=false;
      end;
    inc (j);
    end;
  until fertig;
end;


danke!!

jannik
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 480

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 11.05.07 16:17 
Das inc(j) gehört nicht in die innere for-Schleife, sondern in die äußere.

_________________
We are, we were and will not be.
der auenländer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

WIN XP
Delphi 6 PE
BeitragVerfasst: Fr 11.05.07 16:43 
danke, das klappt super!!

jannik