, . , , 0 255. , , . . , , . , Word, Integer, Longint.
Var, Type Var, :
Var :Set of ;
Type =Set of ;
Var : ;
:
Type
TM=Set of 1..100;
TS=Set of 'a'..'z';
Var Mch:TM; { 1 100}
MSym:TS; { }
M: Set of 1..10; { 1 10}
, , .
:
Var M1,M2,M3:set of 1..99;
Begin...
M1:=[]; { }
M2:=[1,3,5,7,9]; { }
M3:=[2,4,6,8]; { }
...
End.
, .
- , :
Type
Type_month=(Jn,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
TDays=Set of 1..31;
Tmonth=Set of 1..12;
Tsym=Set of 'A'..'Z';
Tmno=Set of Type_month;
Const
SymMno:Tsym=['A','E','I','O','U']; { }
DaysMno:TDays=[1,8,15,22,29]; { }
Spring_Mes:Tmonth=[3,4,5]; { }
Spring_Month:Tmno=[Mar,Apr,May]; { , }
:
1) * - : , . : :
Var S1,S2,S3,S4,S5:Set of 1..10;
Begin
S1:=[1,3,4,6];
S2:=[2,4,5,1];
S3:=S1*S2; - S3 [1,4].
2) + - : , :
S4:=S1+S2; - S4 [1,3,4,6,2,5].
3) - - : , :
S5:=S1-S2; - S5 [3,6].
4) = - ( ): TRUE, , .. .
5) <> - ( ): TRUE, , .. .
6) <= - : TRUE, (.. ).
|
|
7) >= - : TRUE, .
8) IN - . TRUE, ( ), , .
:
Include - : Include(M,elem);
- , elem - , .
Exclude - : Exclude(M,elem).
"+" "-", , .
: , ( ). , 1, - 0. 1 , 8 , 256 32 .
.
1 20 :
1) , 2 3 ;
2) , 2 3.
, , 2, 3. - .
, 2 2; , 3 3; , 2 3 2and3; , 2 3 2or3.
Type TM=Set of 1..20; { 1 20}
Var M2,M3,M2and3,M2or3:TM; { }
k:1..20; { }
Begin
M2:=[]; M3:=[]; { }
for k:=1 to 20 do
begin
if k mod 2 = 0 then Include(M2,k); { 2
2}
if k mod 3 = 0 then Include(M3,k); { 3
3}
end;
M2and3:=M2*M3; { }
M2or3:=M2+M3; { }
write(' 2 3 : ');
for k:=1 to 20 do { }
if k in M2and3 then write(k:3); { 6}
writeln; { }
write(' 2 3 : ');
for k:=1 to 20 do
if k in M2or3 then write(k:3); readln; { }
End.