procedure Tauschen(var a,b: integer );
Var Ztemp : Integer;
begin //Tausch Prozedur für den Sortieralgorithmus
ztemp := a;
a := b;
b := ztemp;
end;
procedure TFrm_Bubblesort.Btn_SortierenClick(Sender: TObject);
var neul,i,limit : integer;
begin
Mmo_sort.lines.clear;
limit:= high( zahlen );
repeat
neul:=0;
for i := 1 to limit do
begin
if zahlen[ i-1 ] < zahlen[i] then
begin
Tauschen(zahlen[i-1], zahlen[i]);
neul := i;
end;
end;
Mmo_sort.lines.add(IntToStr(zahlen[i]));
limit:=Neul;
until limit=0 ;
end;
Hey there !
Ive got the fowllowing problem. I have to make a programm( in school ) wich sorts numbers in the algorithm of Bubblesort.
I already got almost everything done. But in the output it doesnt show mostly the first and the last number.
My teacher said that the problem is hanging somewhere in the index. But now im at the point that i cant do it by myself.
Because i am sitting at this already about like 4-6 houers to get this done.
So if somebody have time to help me .I would be very Thankfull.
ps the code is attached and the
names are in german so if dont know something then ask.
Thats because im from germany so that would excuse my english
.