Q&A

  • [질문..]에러 수정좀 해주세요..
퀵 소트를 해보려구 소스작성을 했는데

계속 에러가 나네요...

이유는 잘몰겟구요...헤헤(바보 초보)..^^



조금만 설명해주세요..부탁...



====소스...

program Project2;

{$APPTYPE CONSOLE}

uses SysUtils;

const

maxsize = 50;

type

afile =array [1..maxsize] of integer;

var

list : afile;

step,n : integer;



procedure printlist(list : afile;

step,n : integer);

var

i : integer;

begin

write('** step',step:2,'**');

for i := 1 to n do

write(list[i]:4);

writeln;

writeln;

end;



procedure interchange(var a,b : integer);

var

TEMP : integer;

begin

TEMP := a;

a := b;

b := temp;

end;



procedure qsort(var list : afile;

m,n : integer;

var step : integer;

var

key : integer;

i : integer;

j : integer;

begin

if m
begin

key := list[m];

i := m;

j := n+1;

step := step+1;



repeat

repeat

i := i+1;

until((list[i] >= key) or (i >n));

repeat

j := j-1;

until((list[j] <= key) or (j >1));

if i < j then

interchange(list[i],list[j]);

until i >= j;

interchange(list[m],list[j]);

printlist(list,step,n);

qsort(list,m,j-1,step);

qsort(list,j+1,n,step);

end;

end;



begin

n := 0;

while not eoln do

begin

n := n+1;

read(list[n]);

end;

end;

step := 0;

printlist(list,step,n);

qsort(list,1,n,step);

printlist(list,step+1,n);

// Insert user code here

end.

1  COMMENTS
  • Profile
    최용일 2000.09.22 19:56
    안녕하세요. 델파이세상(http://www.freechal.com/delphiworld)의 최용일입니다.



    문장을 잘 살피세요.



    ^^ 항상 즐코하세요.



    > ..........................................................................

    > procedure qsort(var list : afile;

    > m,n : integer;

    > var step : integer); ////////// )빠짐...

    > ..........................................................................

    > n := 0;

    > while not eoln do

    > begin

    > n := n+1;

    > read(list[n]);

    > end;

    > //////////////////////////////////////// end;가 더 들어감

    > step := 0;

    > printlist(list,step,n);

    > qsort(list,1,n,step);

    > printlist(list,step+1,n);

    > // Insert user code here

    > end.