20 lines
557 B
Text
20 lines
557 B
Text
def John, Bob, Mary, Serena, Jim; \enumerate set items (0..4)
|
|
|
|
proc SetOut(S); \Output the elements in set
|
|
int S;
|
|
int Name, I;
|
|
[Name:= ["John", "Bob", "Mary", "Serena", "Jim"];
|
|
for I:= 0 to 31 do
|
|
if S & 1<<I then
|
|
[Text(0, Name(I)); ChOut(0, ^ )];
|
|
CrLf(0);
|
|
];
|
|
|
|
int A, B;
|
|
[A:= 1<<John ! 1<<Bob ! 1<<Mary ! 1<<Serena;
|
|
B:= 1<<Jim ! 1<<Mary ! 1<<John ! 1<<Bob;
|
|
Text(0, "A xor B = "); SetOut(A | B);
|
|
Text(0, "A\B = "); SetOut(A & ~B);
|
|
Text(0, "B\A = "); SetOut(B & ~A);
|
|
Text(0, "A\B U B\A = "); SetOut(A&~B ! B&~A);
|
|
]
|