pascalabcnet/TestSuite/CompilationSamples/Sets.pas

15 lines
702 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Работа с множествами
// Базовый тип для множества может быть произвольным
var
s1: set of string := ['Иванов','Попов','Сидорова','Петров'];
s2: set of string := ['Козлов','Петров','Иванов'];
begin
writeln('Множество s1: ',s1);
writeln('Множество s2: ',s2);
writeln('Объединение множеств s1 и s2: ',s1+s2);
writeln('Пересечение множеств s1 и s2: ',s1*s2);
writeln('Разность множеств s1 и s2: ',s1-s2);
Include(s1,'Умнов');
Exclude(s1,'Иванов');
writeln('Множество s1: ',s1);
end.