Autor Beitrag
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 16:51 
Guden

kann mir ma einer das verfahren erklären den quellcode habe ich ... nur habe ich die werte richtig eingelagert in das array
a:=array[0..4] of word;

wenns geht von oben nach unten mit worten erklären =)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
var
  bis,i,j,k : Longint;
  h         : Word;
begin
  a[0]:= StrToInt(Edit1.Text);
  a[1]:= StrToINt(Edit2.Text);
  a[2]:= StrToInt(Edit3.Text);
  bis := High(a);
  k  := bis shr 1;
  while k > 0 do
    Begin
      for i:= 0 to bis -k do
       Begin
         j:= i;
         while (j>=0) and (a[j]> a[j+k]) do
         begin
           h := a[j]; a[j]:=a[j+k];a[j+k]:=h;
           if j>k then dec(j,k) else j :=0;
         end
       end;
       k:=k shr 1;
      end;
  Listbox1.Items.add(FloatToStr(a[0]));


oder wenichstens .. wie ich richtig die werte einlagere und wieder ausgebe =)

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 17:54 
hat sich erledigt dank ayas hilfe ;)
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
procedure TForm1.Button1Click(Sender: TObject);
var
  bis,i,j,k : Longint;
  h         : Word;
begin
  a[1]:= StrToInt(Edit1.Text);
  a[2]:= StrToINt(Edit2.Text);
  a[3]:= StrToInt(Edit3.Text);
  bis := High(a);
  k  := bis shr 1;
  while k > 0 do
    Begin
      for i:= 0 to bis -k do
       Begin
         j:= i;
         while (j>=0) and (a[j]> a[j+k]) do
         begin
           h := a[j]; a[j]:=a[j+k];a[j+k]:=h;
           if j>k then dec(j,k) else j :=0;
         end
       end;
       k:=k shr 1;

    end;
   for i:=Low(a) to High(a) do
      Listbox1.Items.add(FloatToStr(i));
    end;

end.

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 09.04.03 10:45 
foxy hat folgendes geschrieben:
hat sich erledigt dank ayas hilfe ;)

Wo ist denn die Hilfe?

Gruß
Tino