Programming. Loops with parameter

Turbo Pascal . - . , .

loops with parameter




:

  • ,
  • ,
  • .

, For … to … do For … downto …. do, . , , for- .

(While Repeat) . , .

– . – , . , . , , 1. . – , .





« » , , . ( ), . , .

For … to … do: ,

, , «», . , , , . .

2 : . :

for . := 1 to 2 do

begin

;

end;

: . ; 1 2 – ; , . , 1 , begin…end . , <.>, , 1.

for . := 1 downto 2 do

begin

;

end;

. , 1.

For … to … do :

  • , . . 2.
  • . 1.
  • : . ≤ 2.
  • True () .
  • , 1.
  • 3-5 , : . > 2. , , .

For … downto … do , :





  • 3- : . ≥ 2.
  • 5- 1.
  • 6- 3-5 , : . < 2.

loops with parameters




.

-

- ( ). .

loops with parameters means




.

  • (. . ., 1 2) . , , .
  • , , . .
  • . . .
  • , For … to … do For … downto … do , 1.

Turbo Pascal:

, , . . . Break , , . . . .

( «» ) Continue. : , , .

Exit , . () , «» . Exit , .

Halt : .

« » , . , . « » . 3 , .

1

[0..199], . , 2.

:

  1. .
  2. :

a) 9 < < 100, 10 div;

b) mod;

c) ;

d) mod 2;

e) 0, 1.

loops with parameter task examples




2

. .

:

  1. , randomize.
  2. IF, : >0.
  3. , 1.
  4. .

, {}, . 11 : ( 5).

12 counter : 1, Inc.

loops with a parameter in pascal examples




3

. , .

:

. , . 1 .

:

  1. .
  2. , , «0».
  3. .
  4. : >0, 1.
  5. , .

cycles with a parameter in pascal programming




: Turbo Pascal

, . , ++, Turbo Pascal, Delphi, Java . . 80- . ( ). ++ Java.

loops with parameter in c




, : -60 , Pascal C, Java ++. , , . . 70- . « » , 80- – Turbo Pascal, 90- – ++. , «». , .

, . , C Pascal, .

Interestingly, the developers of Turbo Pascal (Old World) used the results of the work of American scientists, while in the New World they actively used the results of research by European experts. In Europe, developers advocate more for the purity and compactness of programming languages, and American minds are more inclined to use new-fangled trends in writing code.




All Articles