[ ] [ ] [ ] [ ] [ ]

2.3. , 170 . .
 
 
 
 
 
1
 
3
 
 
171
165
178
 
2
 
2
 
170
165
 
 
  (  N,    [1:N],  
                [1:N],     [1:N] )
  i, k
  k:=0
    i  1  N |      
     [i]>170
       k:=k+1;  [k] :=  [i]
    
  
   k=0
      "     ."
       i  1  k
              [i]
          
 
 
 
N
i
[i] > 170
K
1
1
2
3
+
-
+
0
1
2
  
2
1
2
-
-
0
-
 
TurboPascal
Program BascetBall;
  Uses Crt;
  Var
     SurName : Array [1..30] of String;  {   }
     Height  : Array [1..30] of Real;    {   }
     Cand    : Array [1..30] of String;  {   }
     NPupil, i, K : Integer;             { NPupil -  ,
                                           K -  }
BEGIN ClrScr;
  Write('   , ');
  WriteLn('   170 .'); WriteLn;
  Write('   ? ');
  ReadLn(NPupil);
  WriteLn('     :');
  For i := 1 to NPupil do
    begin Write(i, '.  - '); ReadLn(SurName[i]);
          Write('      - ');    ReadLn(Height[i]);
    end; WriteLn;
  K:=0; {    }
  For i := 1 to NPupil do
    If Height[i]>170 then
      begin K:=K+1; Cand[K] := SurName[i] end;
  If K=0 then WriteLn('     .')
    else
      begin WriteLn('    :');
            For i := 1 to K do WriteLn( i, '. ' , Cand[i]);
      end;
  ReadLn
END.
 
QBasic
CLS : PRINT "   , ";
PRINT "   170 ." : PRINT
INPUT "   ? " , NPupil
DIM SurName$(NPupil), Height(NPupil), Cand$(NPupil)
PRINT "     :"
FOR i = 1 TO NPupil
  INPUT " - " , SurName$(i)
  INPUT " - " , Height(i)
NEXT i : PRINT
K = 0
FOR i = 1 TO NPupil
  IF Height(i) > 170 THEN K = K + 1 : Cand$(K) = SurName$(i)
NEXT i
IF K = 0 THEN
    PRINT "     ."
  ELSE
    PRINT "    :"
    FOR i = 1 TO K
      PRINT i ; ". " ; Cand$(i)
    NEXT i
END IF
END
 

[ ] [ ] [ ] [ ] [ ]