Алгоритмический язык Pascal

: . . , , .
Set of, :
   type  M= Set of B;
- , - .
:
   type
     M= Set of 'A'..'D';
   var
     MS : M;
:
   var
     C : Set of 0..7;
, , :
   ['A', 'C']    [0, 2, 7]    [3, 7, 11..14].
[] .
, - , . , , , - , , 2 . :
   var
     P : 1..3;
- 1, 2, 3.
   var
     T : Set of 1..3;
:
         [ ]        [1,2]
         [1]        [1,3]
         [2]        [2,3]
         [3]        [1,2,3]
.
[T], T - .
(:=), (+), (*) (-):
         ['A','B'] + ['A','D']        ['A','B','D']
         ['A'] * ['A','B','C']        ['A']
         ['A','B','C'] - ['A','B']    ['C'].
.
: (=), (<>), (<=), (>=). , :
         ['A','B'] = ['A','C']   FALSE
         ['A','B'] <> ['A','C']  TRUE
         ['B'] <= ['B','C']      TRUE
         ['C','D'] >= ['A']      FALSE.
in , , , . - . , :
         A in ['A', 'B']   TRUE,
         2 in [1, 3, 6]    FALSE.
. . ,
         ['A','B','C','D']
         1 1 1 1.
:
         ['A','B','D']   1 1 0 1
         ['B','C']       0 1 1 0
         ['D']           0 0 0 1
- - .
, , . TURBO PASCAL 256.
:
   
   const  seLit: Set of 'A'..'D'= [];
.
. , " 5 36".
. :
  • 1..36;
  • .
   
    Program Lotto;
     var
         nb, k: Set of 1..36;
         kol, l, i, n: Integer;
     begin
        Randomize;
        WriteLn(' kol');
        ReadLn(kol);
        nb:=[1..36];
        for i:=1 to kol do
          begin
           k:=[];
           for l:=1 to 5 do
             begin
               repeat
                 n:=Random(36)
               until (n in nb) and not (n in k);
               k:=k+[n];
               Write(n:4)
             end;
           WriteLn
          end
         end.
—одержание
    ”чебник по ¤зыку Pascal          Ћабораторные работы по программированию          —правочник




Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: