[pascal] Szybkie sortowanie

0
program zad5c;
uses crt;
var
pl:text;
tab:array [1..999999] of integer;
taba:array [1..999999] of integer;
a,i,j,suma,sum,c,d,f,g,z:integer;
          procedure sort( var taba:array [1..999999] of integer; c,d:integer);
          begin
           if c<d then
        f:=tab[a]+1;
        g:=tab[a]-1;
        repeat
        repeat
        f:=f+1 until tab[a] <= taba[f];
        repeat
        f:=f-1 until tab[a] <= taba[g];
        until g>=j;
        taba[g]:=taba[a];
        taba[g]:=z;
        end;
        begin
        clrscr;
        assign(pl,'C:\Documents and Settings\ja\Desktop\pascal\dane5-3.txt');
        reset(pl);
        i:=0;
        repeat
        inc(i);
        readln(pl,tab[i]);
        until eof(pl);
        close(pl);
        for a:=1 to i do
        sort(taba,c,f-1);
        sort(taba,f,d);



readkey;

end.

Z tego miało wyjść szybkie sortowanie pliku . Program ma bledy, nie wiem jak im zaradzic. Prosze o wskazówki :)

0

Po pierwsze pisz po ludzku! Nie chodzi o pisanie po ciele Lucka, ale o pisanie na sposób czytelny dla ludzi!!!!!!!!!!!!!!
Jeżeli nie rozumiesz sensu wcinania tekstu programu, to proszę popatzr na to samo zapisane w sposób troszkę inny.

program zad5c;
uses crt;
var
     pl:text;
     tab:array [1..999999] of integer;
     taba:array [1..999999] of integer;
     a,i,j,suma,sum,c,d,f,g,z:integer;

procedure sort(var taba:array [1..999999] of integer; c,d:integer);
begin
      if c<d then
           f:=tab[a]+1;
      g:=tab[a]-1;
      repeat
           repeat
                    f:=f+1
           until tab[a] <= taba[f];
           repeat
                    f:=f-1
           until tab[a] <= taba[g];
      until g>=j;
      taba[g]:=taba[a];
      taba[g]:=z;
end;

begin
     clrscr;
     assign(pl,'C:\Documents and Settings\ja\Desktop\pascal\dane5-3.txt');
     reset(pl);
     i:=0;
     repeat
          inc(i);
          readln(pl,tab[i]);
     until eof(pl);
     close(pl);
     for a:=1 to i do
           sort(taba,c,f-1);
     sort(taba,f,d);
     readkey;
end.

Ja zwrócę uwagę tylko na to że typ "taki sam" różni się od "tego samego".
Zmodyfikuj:

Const
        Max=999999;
Type 
        tablica = array[1..max] of integer;
Var
        Tab, taba: tablica;
Procedure sort(var tab:tablica; c, d:integer);

1 użytkowników online, w tym zalogowanych: 0, gości: 1