Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
43
Task/Symmetric-difference/Delphi/symmetric-difference.delphi
Normal file
43
Task/Symmetric-difference/Delphi/symmetric-difference.delphi
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
PROGRAM Symmetric_difference;
|
||||
|
||||
uses
|
||||
System.Typinfo;
|
||||
|
||||
TYPE
|
||||
TName = (Bob, Jim, John, Mary, Serena);
|
||||
TList = SET OF TName;
|
||||
|
||||
TNameHelper = record helper for TName
|
||||
FUNCTION ToString(): string;
|
||||
end;
|
||||
|
||||
{ TNameHlper }
|
||||
|
||||
FUNCTION TNameHelper.ToString: string;
|
||||
BEGIN
|
||||
Result := GetEnumName(TypeInfo(TName), Ord(self));
|
||||
END;
|
||||
|
||||
PROCEDURE Put(txt: String; ResSet: TList);
|
||||
VAR
|
||||
I: TName;
|
||||
|
||||
BEGIN
|
||||
Write(txt);
|
||||
FOR I IN ResSet DO
|
||||
Write(I.ToString, ' ');
|
||||
WriteLn;
|
||||
END;
|
||||
|
||||
VAR
|
||||
ListA: TList = [John, Bob, Mary, Serena];
|
||||
ListB: TList = [Jim, Mary, John, Bob];
|
||||
|
||||
BEGIN
|
||||
Put('ListA -> ', ListA);
|
||||
Put('ListB -> ', ListB);
|
||||
Put('ListA >< ListB -> ', (ListA - ListB) + (ListB - ListA));
|
||||
Put('ListA - ListB -> ', ListA - ListB);
|
||||
Put('ListB - ListA -> ', ListB - ListA);
|
||||
ReadLn;
|
||||
END.
|
||||
Loading…
Add table
Add a link
Reference in a new issue