Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Symmetric-difference/XPL0/symmetric-difference.xpl0
Normal file
20
Task/Symmetric-difference/XPL0/symmetric-difference.xpl0
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue