home *** CD-ROM | disk | FTP | other *** search
- PROGRAM d8r2(input,output,dfile);
- (* driver for routine PIKSR2 *)
- CONST
- np=100;
- TYPE
- glsarray = ARRAY [1..np] OF real;
- VAR
- i,j : integer;
- a,b : glsarray;
- dfile : text;
-
- (*$I MODFILE.PAS *)
- (*$I PIKSR2.PAS *)
-
- BEGIN
- glopen(dfile,'tarray.dat');
- readln(dfile);
- FOR i := 1 to np DO BEGIN
- read(dfile,a[i])
- END;
- close(dfile);
- (* generate b-array *)
- FOR i := 1 to np DO BEGIN
- b[i] := i-1
- END;
- (* sort a and mix b *)
- piksr2(np,a,b);
- writeln('after sorting a and mixing b, array a is:');
- FOR i := 1 to 10 DO BEGIN
- FOR j := 1 to 10 DO BEGIN
- write(a[10*(i-1)+j]:6:2)
- END;
- writeln
- END;
- writeln('... and array b is:');
- FOR i := 1 to 10 DO BEGIN
- FOR j := 1 to 10 DO BEGIN
- write(b[10*(i-1)+j]:6:2)
- END;
- writeln
- END;
- writeln('press return to continue ...');
- readln;
- (* sort b and mix a *)
- piksr2(np,b,a);
- writeln('after sorting b and mixing a, array a is:');
- FOR i := 1 to 10 DO BEGIN
- FOR j := 1 to 10 DO BEGIN
- write(a[10*(i-1)+j]:6:2)
- END;
- writeln
- END;
- writeln('... and array b is:');
- FOR i := 1 to 10 DO BEGIN
- FOR j := 1 to 10 DO BEGIN
- write(b[10*(i-1)+j]:6:2)
- END;
- writeln
- END
- END.
-