home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
NRPAS13
/
ECLAZZ.DEM
< prev
next >
Wrap
Text File
|
1991-04-29
|
1KB
|
47 lines
PROGRAM d8r11(input,output);
(* driver for routine ECLAZZ *)
CONST
n=15;
TYPE
glnarray = ARRAY [1..n] OF integer;
VAR
i,j,k,lclas,nclass : integer;
nf,nflag,nsav : glnarray;
FUNCTION equiv(i,j: integer): boolean;
BEGIN
equiv := FALSE;
IF ((i MOD 4) = (j MOD 4)) THEN equiv := TRUE
END;
(*$I MODFILE.PAS *)
(*$I ECLAZZ.PAS *)
BEGIN
eclazz(nf,n);
FOR i := 1 to n DO BEGIN
nflag[i] := 1
END;
writeln;
writeln('Numbers from 1-15 divided according to');
writeln('their value modulo 4:');
lclas := 0;
FOR i := 1 to n DO BEGIN
nclass := nf[i];
IF (nflag[nclass] <> 0) THEN BEGIN
nflag[nclass] := 0;
lclas := lclas+1;
k := 0;
FOR j := i to n DO BEGIN
IF (nf[j] = nf[i]) THEN BEGIN
k := k+1;
nsav[k] := j
END
END;
write('Class',lclas:2,': ');
FOR j := 1 to k DO write(nsav[j]:3);
writeln
END
END
END.