Code: Alles auswählen
Type
MySet = Set Of char;
Function PlotSet(Const aSet: MySet): String;
Var
i: Char;
Begin
result := '';
For i := #0 To #255 Do Begin
If i In aSet Then Begin
If result <> '' Then Begin
result := result + ', ';
End;
result := result + i;
End;
End;
End;
Procedure TForm1.Button1Click(Sender: TObject);
Var
a, b: MySet;
Begin
a := ['a', 'b', 'c'];
b := ['b', 'c', 'd'];
Memo1.Clear;
memo1.Append('A = [' + PlotSet(a) + ']');
memo1.Append('B = [' + PlotSet(b) + ']');
memo1.Append('A union B = [' + PlotSet(a + b) + ']');
memo1.Append('A sub B = [' + PlotSet(a - b) + ']');
memo1.Append('B sub A = [' + PlotSet(b - a) + ']');
memo1.Append('A intersect B = [' + PlotSet((a + b) - (a - b) - (b - a)) + ']');
End;
Code: Alles auswählen
A = [a, b, c]
B = [b, c, d]
A union B = [a, b, c, d]
A sub B = [a]
B sub A = [d]
A intersect B = [b, c]