type 集合型名 = set of 基底型 ;
または
var 集合変数名 : set of 基底型 ;
s*t(共通部分), s+t(和集合), s-t(差集合)
が定義されている。
s=t ( 等しい ), s<>t ( 等しくない ),
s<=t ( s が t に含まれる ), s>=t ( s が t を含む )
が定義され、また、要素の型の変数 x と集合 s に対して条件判定
x in s ( x が s に含まれる )
が定義されている( 結果は論理型 )。
program sample7a;
const name='/home1/is_staff/shiota/timetable';
type
day=(Sun, Mon, Tue, Wed, Thu, Fri, Sat);
weekday=Mon..Fri;
lecture=1..5;
str=varying[50] of char;
var
i:day;
j:lecture;
jugyou:array[weekday,lecture] of str;
a:str;
table:text;
begin
reset(table,name);
for i:=Mon to Fri do
for j:=1 to 5 do
begin
readln(table,a);
while length(a)<14 do a:=a+' ';
jugyou[i,j]:=a
end;
for i:=Mon to Fri do
begin
write(i,' : ');
for j:=1 to 5 do write(jugyou[i,j],' ');
writeln;
writeln
end;
close(table)
end.