Вы находитесь на странице: 1из 214

1

,.

__________________________________________________________

1999

2
.0

........................................................................................................................................................5
0.1. ?...................................................................................................................................................5
0.2. ?.............................................................................................................................................................5
0.3. ?.........................................................................................................................................................6
0.4. .......................................................................................................................6

I. ............................................................8
.0 ......................................................................9
0.1. .........................................................................................................................................9
0.2. . ......................................................................................9
0.3. ........................................................................................................................11

.1 ...................................................................................................12
1.1. . ..............................................................................................12
1.2. ......................................................................................................................................13
1.3. . ?....................................................................................................13
1.4. ......................................................................................................14
1.5. ............................................................................................................................................15
1.6. ..............................................................................16
1.7. .....................................................................................17
1.8. .......................................................................................................................18

.2 ...................................................................................................21
2.1. .............................................................................................................................21
2.2. ..............................................................................................................23
2.3. ...........................................................................................................................23
2.4. ...............................................................................................................................24
2.5. ...................................................................................................................27

II. .............................................................29
.0 () . -. ........30
0.1. Write...............................................................................................................................................30
0.2. .....................................................................................................................................31
0.3. .........................................................................................................32
0.4. WriteLn. ............................................................................................................................33
0.5. . ......................................................................................................34
0.6. (VAR)......................................................................................................................................35
0.7. ..........................................................................................................36
0.8. ........................................................................................................................................................37
0.9. . .....................................................................................................38
0.10. .................................................................................................................................39
0.11. ...............................................................................................................40
0.12. ReadLn Read...............................................................................................................42
0.13. ............................................................................................................................................43
0.14. ..............................................................................................................................................44
0.15. ...............................................................................................................................................45
0.16. ....................................................................................................................................................................45

.1 ........................................................................................................46
1.1. IF .......................................................................................46
1.2. IF.......................................................................................................................................48
1.3. ......................................................................................................................................................49
1.4. ..................................................................................................................................50
1.5. if. if. ...............................................50
1.6. Char....................................................................................................................................53
1.7. case................................................................................................................................................53

.2 .................................................................................................................56
2.1. GOTO. . ....................................................................................................................56
2.2. if......................................................................................................................................58

3
2.3. repeat...................................................................................................................................................59
2.4. while...................................................................................................................................................60
2.5. repeat while..............................................................................................................................61
2.6. for........................................................................................................................................................61

.3 ..................................................................................................64
3.1. ..................................................................................................................64
3.2. ..................................................................................................................................................................65
3.3. ........................................................................................................................................................................65
3.4. .....................................................................................................................................................................67
3.5. ............................................................................................................68
3.6. .........................................................................................................................................................68
3.7. ...................................................................................................................................69

.4 ..........................................................................................................................................71
4.1. .........................................................................................................................................................71
4.2. ................................................................................................................................................72
4.3. ...............................................................................................................................................75
4.4. Halt Exit............................................................................................................................75

.5 ...............................................................................................................................................77
5.1. ....................................................................................................................................................77
5.2. Graph, .............................................................................77
5.3. .........................................................................................................................................78
5.4. . . ....................................................................................................81
5.5. .......................................................................................................83
5.6. .................................................................................................84
5.7. .....................................................................................................................................85

.6 ...........................................................................................87
6.1. ........................................................................................................................................................87
6.2. -............................................................................................................87
6.3. ............................................................................................................89
6.4. .................................................................................................................................91
6.5. .................................................................................................................................92
6.6. , ...........................................................95
6.7. . ReadKey KeyPressed...........................................................96
6.8. .........................................................................................................................................................97
6.9. . .....................................................................................................100

III. .........................................................103
.0 ...........................................................................................104
0.1. ........................................................................................................................................................................104
0.2. ..........................................................................................................................................................104
0.3. ..............................................................................................................................................105

.1 ................................................................................106
1.1. ...............................................................................................................................................................106
1.2. ............................................................................................................................................................107
1.3. .......................................................................................................................................................................108
1.4. ................................................................................................................................................111
1.5. .......................................................................................................................................112
1.6. .......................................................................................................................................112
1.7. Boolean.............................................................................................................................................113
1.8. ...................................................................................................................................................113
1.9. ()...................................................................................................................................114
1.10. ........................................................................................................................115
1.11. Char. ...........................................................................................................116
1.12. String. ............................................................................................................117
1.13. .........................................................................................................................................................................118
1.14. .................................................................................................................................................................120
1.15. . ................................................................................122
1.16. .......................................................................................................................................................................123

.2 ........................................................................................125
2.1. .........................................................................................................................................125
2.2. .......................................................................................................................................................................127
2.3. . ..........................................................................................128

4
2.4. .............................................................................................................................................129
2.5. - -......................................................................................................130
2.6. . . ..........................................................................................................................................131
2.7. ..................................................................................................................................................................132

.3 ..........................................................................................................................135
3.1. ................................................................................................................................................135
3.2. ................................................................................................................................136
3.3. ...................................................................................................................................................................137
3.4. .................................................................................................................................................137
3.5. ............................................................................................................................................138
3.6. .......................................................................................................................................139
3.7. ................................................................................................................................................................139
3.8. ....................................................................................................................140

.4 .......................................................................................................147
4.1. ...........................................................................................................................................147
4.2. ......................................................................149
4.3. ................................................................................................................................................150
4.4. Graph..........................................................................................151
4.5. ...............................................................................................................152
4.6. .......................................................................................................................153
4.7. ( CRT).........................................................................................154
4.8. ( DOS)..............................................................................................................155
4.9. .................................................................................................................156
4.10. ............................................................................................................................157

IV. ....................................................................................159
? ......................................................................159
...............................................................................................................................................159
(1) ............................................................................................................................................................159
(2) . . .............................................................................................161
(3) . ............................................................................162
(4) .............................................................................................................................................163
(5) . ..............................................................................................................164
..........................................................................................................................................169
..........................................................................................................170
....................................................................................................................................170
(exe)...............................................................................................................................171

. .................................................................................................172
1. ..........................................172
2. .......................................................................................................................175
3. , ................................................................................177
4. ...............................................................................................................................179
5. ........................................................................................................................................................182
6. ....................................................................................................................................................208
7. ...............................................................................................................................................209


,

, .
,
.

. :
- .
, , ,
, :
, ,
.

0.1. ?
. , , ,

. - 6-11 345
. , , -
, . .
,
, ,
, .
, ,
, ,
. ,
- (, ).
. . ( .)
, , -
.
, .
. , ,
.
, ,
. -, , ,
. -, , .
, ,
.
, .
, , .
.

0.2. ?
, , .
.
, ,
, . , ,
. , - , . ,
, .
. . ,
, , .
.
, ,
. ,
. .
.
, (Borland Pascal for Windows, Delphi, Visual Basic .)

6
, , ,
.
, (Pascal,
TurboPascal, Borland Pascal, Borland Pascal for Windows, Basic, QBasic, Quick Basic, Visual Basic, Visual Basic .NET
.). .
, , , .
, - . ,
.
, , ,
, TurboPascal 7.0 QBasic. ,
( 25-50 ). , .
- .
, ( , ,
). , .

0.3. ?
, ,
TurboPascal 5.5, TurboPascal 6.0, TurboPascal 7.0 Borland Pascal DOS,
- . , . ,
.
TurboPascal 7.0.
.
( - ).
. , TurboPascal 6.0, TurboPascal 7.0
Borland Pascal DOS , .
. , , .
. , ,
,
- . , .

0.4.
:
I. . . , .
:

, , , , , ;
;
: , , ;
;
.

II. .
. , , . ,
, , .
. ,
, , ,
, .
III. . :
. , ,
, , , .
, ,
.
- , , ,
, , . ,

7
,
.
IV. .
TurboPascal 7.0. , ,
, .
, , ,
.
. .
, , .
,
. ,
.

I.


,
:
, , , , .
: ,
, .
.
.

.
, .

.0

0.1.
- , .
, .
.
:

.
. ,
.
,
. ,
, ,
, , , .
, .
, , .
, . ,
.
, , , ,
. , ,
. .
, .
, , , ,
. , , ,
.
. , ,
, , ., ,
, .
, ,
, .
, , ,
, ,
, ,
.

0.2. .
.
? , -
. . ? , ,
, - -. , , 17
, . ,
. , :
1.
2.
3.

10
4.
5.
6.

,
1
,

, ,
.
- , ? , ,
. ,
:
1.
2.
3.
4.

- .
- .
- .
.

, , .
, , . ,
, ,
, ,
,
, , . ,
1.
- ( ,
), , (-
- ), .
.
.
- , , ,
, , . :
-, -; ,
; , ..
, , ,
.
, ,
, - ,
, - , , - -
. , Quake, ,
, - .
Quake , ( ,
).
, , ,
.
,
. (, ,
, , , .)
. , , .
? , , .
, .
. - -
,
,
.
, . ,
, , -
.
,
.
1
, .
, .

11

, :
- ,
-, - .

, .

0.3.
, , ,
, , - . ,
.
, , - ,
. , , , , , .
,
.
, . , ,
, , .
, ? , .
:

- .
.
.
.
, . , .
( ) ,
, . , , ,

( - ). ,
, , .
. ,
- . ,
, . ,
, . ,
, - ,
: " ?"
, 2500. ,
" ?" ..
. ,
, -
, - ..

, ,
, , , .

12

.1

1.1. .
, . ,
. , , .
:






, , , .
, .

" ". ?
: , ,..., ,...,
... . . (, ,
) . ,
. . ,
, ,
, , . ,
, . ,
. :

1. 5
2.
3. 3
4.
5.
6.
7.

, , .

13
, , ,
:

, , ,
..
2.
, ,
3.

4.

1.

, ,
, , ,
, , , ,
.
.

1.2.
? ,
, , . ,
.
, ,
? , , .
? . , ,
6 ( 5 ),
, , ,
. 6 7, ,
.
, ,
, , . ,
- , , ..
. , , - .
.
, ,
. ,
.
1: ,
.

1.3. . ?
? , .
. , .
. . ?
. , " ", "
" , " ".
? , . ,
. (
.1.1), , , ,
,
. ,
.
, . , ?
. . . , . ,
, .1.1, , , ,
. , , ,
, .
, :
. , .
. , ,

14
. ,
. , . ,
- . - ? ,
. .
, , "
". " " " "
" ".
.
: , , ,
:

1.
2.
3.

: ( ),
. , .
( ), ( 5
) .

1.4.
, , , ,
.
. , , , .
, , ,
. . ,
. , 0.1 .
, - (, , , )
- .
.
, .
, , .
- ,
.
, - . ,
, ( ).

, :
.
, .

:
.
.
.
.
, .
, "". ,
- , , ""
? , , -
. , , , "":
1.
""
2.
""
3.
""
, (5-7)/(10+40):
1.
7 5
2.
40 10
3.

15
4.

, .
.
, ?
, ,
(), ,
. . ,
, . ,
, 2.4.

1.5.
? , , ,
. .
, , , - ,
( , ,
).
- ,
2 ,
:





,
,

, , , ,
. , , ,
"". , , - .
, . -
-, "" .
, .
, ,
. ,
, -, , -,
, ,
, , ..
-, , "
". - " "
- "". , ? , , .
? , , , ,
, .
. ,
( ) ,
. , , ,
, - Turbo Pascal C++ , ,
.
, , . ? -
, . ,
, .
. ,
,
, .
2

, , , ( 2.2).
, . ,
, ,
.

16
, , ,
, .

Logo

Basic
Pascal

C
Assembler

LISP, Prolog

, ,

,
,

,
, , ,

,

, , , ,
.
, , , ,
-. , ,
. :

3 + 2
:

Write (3+2)
, ,
, ( .), ( , .).
, ,
, .
, .
3 + 2 ,
, . ,
, , (
) .

1.6.

.
. . , :

, . .
:

.
,
, - ..
. - .
.
:
28
60

28 , ,
28 .
60 .

17

40
90
50
90
40
90
50
90
40
45
36
90
36

,
. - ,
- - . . ,
, ,
, , . ,
( ) - 60 ( 40),
:

, , ,
- , . ,

. .
. ,
, .
? . ,
.

1.7.

, .
(.1.1):
0.

, ,
.
1.
, (),
, .
. , ,
, .
2.
.
.
3.
.
, ,
. , ,
, . , - ,
, ..
.

18
4.

.
( , , ,
, ) ,
, .. ,
. , ,
.
, .
5.
. -
, . ,
, . ,
.
. , .
, ..
. , (,
, , !).

1.8.
. . , - ,
. - ,
,
, 0.1? , , .
!
,
, .
.
. , , , ,
, . , ,
,
.
: ,
, ,
,
. .
. - ?
, . , ,
, , ,
(), - ,
. ,
. .
:
1.
2.
3.
4.
5.

. 2.
. 3.
. 4.
( ) . 5.
2.

. ,
, , (
, , " 3."). , ,
, 5,
2-3-4-5.
. -
.
2
3 , , .
, , ,
.
. - -
,
, , . ,
. ,
. .

19
, . ,
.
, .

..
, , 3
. , 1.3
. , , , ,
.
( ). ,
, , . ,
. 5 :
1.
.
2.
.
3.
.
4.
.
5.
.
, , 20 .
, -.
, , .
( ).
, :
1.

2.

3.

4.

5.

, , :
1.

2.

3.

.
.

(). :
, ,
? . , R ,
V - . , ,
? , ,
.
, ,
. :
1.
2.
3.
4.
5.

, - .
, 5.
R, .
V, .
.

2,3,4 - . ,
, - . :
, , , ,
- ..
,
:
1.
", - , ?"
2.
.
3.
"" "", "
!", " !"
4.
" - ?"
3

( )

20
5.
6.

.
. . . . . . . . . . . . . .
.............

( ,
, ).
.
.
.

21

.2

2.1.
, , , .
, .
: , ,
, .
, .
.
. 0.1, .
:

,
:

()


,
. , , : (
), ( ), ,
- , ,
, . ,
.
. ,
.
, ,
, .
, .
, "" - .
, , ,

22
.. , , ,
, , , ,
. , " ",
" ".
"" ,
. " "
. ,
. , , -
.
,
, . , -
- , .
2.1.1.

,
. - ,
, . :
1.

2.

3.

4.

.
. , ,
- ()
. () .
, , .
( .)
,
.

.
. , .
. ( , ,
, , . .)
, , (
) - , .
, . ,
. , ,
, ,
.
, ,
. , ( )
, "" ,
. ( 3)
,
. ,
( ). ,
, - .
( -0.25),
, , .
(). -
, .
, ,
, (, ).
, ,
(-0.75) , - .
,
.
, , ,
, , .
, ,
, ,

23
. , , .
3 -0.25 ( ), -0.75 (
). - , ,
, - ,
. . .
- , .
10000 , ,
10000 . ,
, .
, .
, , .
.
,
() ().
- , .
. ,
. ,
. .
, .
, , 2.4.

2.2.
.
- + , .
. ? ,
.
. ,
, , .
5 . 1000 (
, ), , 1000 .
, , ,
. ( , ,
.)
.

. , ,
.

2.3.
, .
, ,
2.1, . . , ,
. , 2.1
.

. , .
, ,
( - )
() - , ( ),
. ,
,
, . , ,
,
. ,
, ()
, ,
.
, -
- ( -

24
). , , , ,
, , , ,
.
, , ( - ).
,
, , .
- .
. ..
:
, ( ..)
. , MS-DOS Windows.
- .
, ,
. ,
.
, .
, , .. ,
. , , ,
, 2.1.
, . -,
, , . -, ,
, , . -,
. :
. ,
, .
, . .
, , , ,
- ,
, ..

2.4.
, "" .
.
, :

, , .
, ,
.
, , .
,
.
2.4.1.


.
1. . .
. , ,
, , .
2. . " "
, . .
: "", "", "", "".
- ,
, , "", - , , "". ,
.
.
. ,
, .
, ,
-, .
3. . , .
. , ,
.

25
4. . , : "
"" " "?". ,
. :
, .
- . .
- ,
, .
, . , , "",
. , .
, .
, , "?
, .
, .
, . , ,
.
5. . , - .
6. . , ()
. .


1. (). ,
(). , , ,
, .
.
(. ).


, 640 480 .
640480=307200.
. , -
.
, ().
,
, . ,
, - 4 CGA SVGA.
,
: CGA, EGA, VGA, SVGA. SVGA.
2.. , , , , , ,
, . - ,
, , .
,
. ,
. ()
, .
.

26
(), .
,
. , ,
. .
. ,
.
3. - ,
, .
4.. , , ,
. , .
, PC Speaker.
, ,
.
4.1.
5. . ,
. .


.
1. ( ). : 1)
, .
- , . 2)
, ,
128 1024 ( 1
) . , , , ,
1000 . ,
, , .

"" - .
, (. ).
, .
, ,
40000 200000 .


. ,
, ,
.
:
, .. ,
, ,
, ,
.
, , ,
, , ,
, .
2. . .
,
. . ,
.
- .
- , ,
, , .
- , ,
. -
.
-
.

27
, , ,

.
.
,
, ,
, ,
. ,
. ,
.
3. - (CD-ROM). - , .

.
- , , , ( 600 ).
, , ,
.

. .
.
,
, (, , )
.
. ,
- , .
,

. .
, ?
. , ,
; - .
, , ,
.
. Internet.

2.5.
, .
,
, .
, -
. ,
.
, - ,
.
? ,
, , , 4.
(, , , .),
. .
? , 5.
() .
, . ,
. , ,
. (, )

.-

---.

. , ,
, -
.
, - . ,
, 10000000, - 10010111, 7, 00110111.
, :
?
,
. .
4


, - .
, -.
5

28
. .
, , ,
:

,
. ,
, 3 .
8 .
"" .
, , .

, - .
, -
. - -
, - , .
, (
). ,
111

100

010

001

. . . . . . . . . . . . . . . . . . . .
000
()
,
.
, ,
.
. ,
..,
- . -
, - . .
: , .
, 88 00111000 00111000,
, .
, ,
.
8 ,
. , 1 = 8 .
________ _ _________

, , , ,
.

29

II.

, , .
,
. .
. -
, . ,
, .
, ,
.
, . , , , , ,
. , ,
(. 1.5). (. 1.3).
(4.3),
.
,
.

30

.0 ()
. .
0.1. Write
, , ,
, () .
, 1999. Write.
- Write(1999). , , . -
Write "". , ,
.
3 4. ,
, Write, : , .
, Write 1999, ( ), Write
1999, , , . (, ,
Write , .)
:


Write( -500)
-500
Write(3 + 2)
5
: ,

Write(3 * 2)
6
*
Write(2 * 2 - 1)
3
Write( '!' )
!
, ,
Write( ' ' )

Write( 3+2 , 4+4)
58
, : . ,
. , Write.
Write( '' , 4+4 , '' )
8
, Write .
. - :
1) ''
2) 4+4
3) '' . . ,
Write, ,
.
,
. : .
:
Write ( 8, '',3*3,'' )
89
, . ,
, - , .
8
''
3*3
''
, , ,
.
''
''
:
Write ( '',4
+4,
'' )
8
, (, )
, . , ,
:

31
Write( '',4+4,' ' )
8
Write( ' ',4+4,' ' )
8
Write( '16+16=' , 16+16)
16+16=32
: '16+16=' 16+16 . ,
, , , 16+16= . , , .
Write( 3+2 , ' ' , 4+4)
5 8
. - , - ' ' .
, .
2: ( ),
Write(12, 5 + 1, 5 + 1, =, 120+21)

0.2.
, Write . ,
, . :
BEGIN
Write('!');
Write(8+1);
Write(5-2)
END.
, Write, . ,
" " - BEGIN END,
. BEGIN END , Write,
- .
" ":
1. BEGIN , , . (
). BEGIN , "'".
2. END , , . END
, "".
3. . BEGIN END
.
, , , ,
. , ,
! , 9, 3. .
!93
, , ,
:
BEGIN
Write( 8 +1
-2) END.

Write(
;Write( 5

'!')

, , , .
, - , .
bEgin WriTe( '!') ; write( 8+1) ; WRITE( 5-2)

enD.


( 0.2) .
. -
, .
, , . :
BEGIN
Write('!');
Write( 8+1) ;
Write( 5-2)
END.

{ !}
{ 5 2 }
{ }

32
, , ,
, . , ,
, - ,
, 4.2.

0.3.
,
. (
, .) ,
, . ,
,
- , , .
IV, , ,
, .
IV, , , . ,
IV .
.
,
:
1) . ( turbo.exe). , ()
. . , F10,
File New. ( File New).
2) , .
3) , . File Save,
, .
4) . Run Run, , Alt-F5,
: Alt, F5. ,
Write .
5) , ( )
.
. IV.
3.

, ,
!93. .
, .
, .
.
5. END. .
Unexpected end of file, .
, ,
. Esc.
6. Write(!).
; expected, .
, ,
. ,
.
7. Wite(!). Unknown identifier, -
. Write.

33
8. -
Write(!), Write(!). String
constant exeeds line. , ,
, .
9.

. Syntax error,
. , ,

.
10. -
Write(!), Write (! .
)
expected, .
11. -
Write(!), Write !).
;
expected, , .
( , ,
). ,
.

0.4. WriteLn.
WriteLn - " '" , - .
, Write, - Write
Write WriteLn , WriteLn -
. :

BEGIN Write
BEGIN Write

( '' ); Write ( '' ) END.


( '' ); WriteLn( '' ) END.

BEGIN WriteLn( '' ); Write

( '' ) END.

BEGIN WriteLn( '' ); WriteLn( '' ) END.

. -
, ,
. , ,
, "" . ,
BEGIN, :
B B_
E BE_
G BEG_
..
, ,
, .
, ,
Write WriteLn,
. Write WriteLn , Write
, WriteLn ,
- .
WriteLn .
WriteLn .
3: (
), :
BEGIN
Write (1992);
WriteLn ( '
M !' );
WriteLn (6*8);
WriteLn;
WriteLn (' ' ,
END.

6*6,

'. :' , (6+4)*3)

: * . ,
. ? ,

34
, , . WriteLn.
? ? WriteLn . ? ?

0.5. .
.
130 . : r=130. 140 , r=140. ,
r . . 130 140
r.
.
.
. ,
, - .
, ? ,
.
, . , ,
6, := 6 . , = := .
, :=6 . ,
6. :=6 , .
:= , ,
. , . ,
:
. . . . a:=2*3+4; b:=a; y:=a+b+1 . . . .
, a 10, b 10, y 21. :

v := -2+10; h := 10*v; s := v+h


t := 0; n := 2*t+40; z := -n

v=8
t=0

h=80
n=40

s=88
z= -40

, " ",
. ,
WriteLn. :

v := -2+10;
v := -2+10;
v := -2+10;
v := -2+10;
v := -2+10;
v := -2+10;

h := 10*v; s := v+h; WriteLn (s)


h := 10*v; s := v+h; WriteLn ( 's' )
h := 10*v; WriteLn (v+h)
WriteLn (v+10*v)
h := 10*v; s := v+h; WriteLn (v, ' ' ,h, ' ' ,s)
h := 10*v; s := v+h; WriteLn (v+1000, ' ' ,10*h, ' ' ,s)



88
s
88
88
8 80 88
1008 800 88

, := ,
. :=34, 34:=. z:=f-v+990 , fv+990:=z. , ,
, , .
.
. (, d+2d),
. , , ( 3d). ,
, , , , .
( d). ,
(, y:=a+b+1), ,
, ( a b).
. : . . . :=10;
y:=a+b+1 . . . , b . ,
a+b+1 , b.
-. , b ,
: b , ,
, , -8904 .
:

35
:= ,
, - , .
" " ( )
, .

4:
s:=2*k; t:=6-s ?

t :

k:=1+2;

0.6. (VAR)
0.5 , .
. - BEGIN, .
:
VAR a,b : Integer;
BEGIN
a:=100;
b:=20;
WriteLn (a + b)
END.
, 120.
. b.
. , VAR ( ,
variable - ). ,
,
. b,
BEGIN END. Integer ( " '", ) , b
, . , -
, , , ,
.
? ,
(.2.2), (.1.7).
, , .
, ,
. (
).
, ,
. "" :
, - , , ,
. , ,
. ,
, .
, -
, . , ,
. ,
, . -
, ,
. , . . .
, ,
- , . , ,
, , ( ).
: 100 20 - ,
, ? ,
. .
0.6.1.
Integer LongInt
, , , Integer,
. Integer . ,
b . -
, - -32768
32767. =40000,
.

36
, ,
Integer, LongInt ( Long Integer - , ).
LongInt 4
-2147483648 2147483647.
5: =9000000 . -
b=1000 . , .
.
6: . LongInt, Integer.
?

0.7.
:
VAR a,b,y : Integer;
BEGIN
a:= 10;
b:= 6;
y:= a+b+1;
WriteLn (y+200)
END.
BEGIN END ,
VAR a,b,y : Integer . .
0.5 , , " ",
" ". , "
":
(, y:=a+b+1),
(a+b+1). ( a b ),
( 10 6),
. (17)
, , ( y).
, " , 2", "
, , 2".
, a,b,y
. .
a:=10.
a 10. b:= 6 b .
y:= a+b+1. , a b, 10 6,
a+b+1, 17 y.
WriteLn (y+200). y, 17, 17+200 217 .
:

a:= 10
b:= 6
y:= a+b+1
WriteLn (y+200)

a
b
y
10
10
10
10

?
6
6
6

?
?
17
17

217

WriteLn:
WriteLn ,
, ,
.

7: b:= 6 y:= a+b+1. ?

37
0.7.1.

, .
:
VAR k : Integer;
BEGIN
k:=10; WriteLn (k); k:=25; WriteLn (k); k:=4; WriteLn (k)
END.
k:

k:=10
WriteLn (k)
k:=25
WriteLn (k)
k:=4
WriteLn (k)

10
10
25
25
4
4

10
25
4

, k . ,
k:=25 10 25. ? ,
. :
- , ,
, , - .
10 k 25, WriteLn (k) 25.
k:=4 25 , WriteLn (k) .
?
VAR f : Integer;
BEGIN
f:=30;
f:=f+4;
WriteLn (f)
END.

f:=30 f 30. f:=f+4?


f+4 , f
, , 34. 34 , ,
, f. 30 .
,
f 4.

f:=f+4 f , ,

8-10:
, :
8) a:=100; a:=10*a+1; WriteLn (a)
9) a:=100; a:=-a; WriteLn (a)
10) a:=10; b:=25; a:=b-a; b:=a-b; WriteLn (a,' ',b)

0.8.
(a, s, d ... ).
, , ,
. :
a:=3;
b:=4-a;
WriteLn (a,b+50)

Summa:=3;
ROBBY:=4-Summa;
WriteLn (Summa,ROBBY+50)

38
3 51. , ,
, , Summa
, 3.
.
:
,
, .
:
a
x
velichina
zzz
polnaja_summa
tri_plus_dva
s25
k1
_k1
___
a1b88qq
oshibka
:

-
polnaja summa
- (), ,
2as
-
Domby&Son
- & , ,

0.9. .
- , , , .
, .
WriteLn ,
(, a+b-8). .
, .
.
( ) :

+
*
/

10
5
17 div 5

2
4
2

17 mod 5

3
2

ab+cd , : a b c d.
: a*b+c*d. ,
, ab, , cd.
. , a * (b+c).
. ,
, ,
,
. .
:
(a+1)/(b+1). ,
a+1/b+1, , , ,

39
, 1 b ,
a 1.
: ? : ,
. . : :

: (1 + a / (2+a*b)) / (3+a) * b . , ,
- (1 + a / (2+a*b)) (3+a) (3+a) b.
. : ((1 + a / (2+a*b)) / (3+a)) * b . .
, .
. ,
. "
", ( 3+a
2+a*b). , 1 + a / (2+a*b) , ..
. , , ,
. :
62.8 -
.
.
, , , - Sqr.
.
, . ,
- Sqr(5), a+b - Sqr(a+b). Sqr -
square - . , , .
:

Sqr (5)
Sqrt (25)
Pi
Frac (23.192)
Int (3.98)
Round (5.8)
Abs ( -20)
Random
Random (200)

25
5
3.1415...
0.192
3.0
6
20
0.73088
106

()
(0 - 1)
(0 - 199)

, sin, cos, arctan, exp, ln


.
:

Sqr(2+1)
9

10+Sqr(2+1)
19

1+Abs(5-8)
4

Sqr(2)+Sqrt(35+1)
10

Sqrt(8+Int(41.5))
7

21 div (Round(Pi+1))
5

Randomize. ,

11: , :
VAR a,b: Integer;
BEGIN
a:=(Sqr(2)+1)*(20- Sqr(2*2))-11;
b:=11 div (a-4);
WriteLn (Sqr(a)+b-1)
END.

0.10.
:
VAR a,b,y : Integer;
BEGIN
a:=10; b:=6;

40
y:= a / b;
WriteLn (y)
END.
, ,
, , y .
VAR a,b,y : Integer
. .
b:=6 b:=2 , .
? , .
(Integer), (Real).
. :
VAR a,b :Integer;
y
:Real;
BEGIN
a:=10; b:=6;
y:=a / b;
WriteLn (y)
END.
- Real " '", "". Real
6 .
WriteLn (y)? , 1.666666 ,
. , Real,
(), . 3.5,
, , , -
- WriteLn (y :8:3). , y Real
3 ,
8 , , , .

1.667. 8 ( ,
, , ). 8 3
.
: (y :38:3),
(y :20:10), ( , y :8:3).

! ,
, :
1. , ,
, .
, ,
.
2. ,
, .
, for i:=1 to 5, for i:=1 to 10.
3. . , ,
. ,
,
, - .
,

.

0.11.
:
: - 12.41 ., - 8 ., - 5 .
.

41
1. . - .
, , .

: = , = .
2. . .
, , ,
, , , ?
shirina ( ) , , width ( ).
( , , , , -
).
:
shirina

tol

visota

pl

3. , . - ,
. , , - .
:
VAR
shirina,tol,pl : Integer;
visota,V
: Real;
4. .
:
BEGIN
shirina:=8; tol:=5; visota:=12.41;
5. , ,
.
pl := shirina * tol;
V := pl * visota;
6. . ,
" ". pl V
. , WriteLn,
:
WriteLn (pl,' ', V :10:3)
END.
, V Real,
(.0.10).
:
VAR shirina,tol,pl
:Integer;
visota,V
:Real;
BEGIN
shirina:=8; tol:=5; visota:=12.41;
pl := shirina * tol;
V := pl * visota;
WriteLn (pl,' ', V :10:3)
END.
: 40 496.400 .
:
BEGIN

WriteLn (8 * 5, '

' , 8 * 5 * 12.41 :10:3)

END.

. ,
.

12-14:
:
12) 5030 2010.
, . : , , .
13) 800. . 5
.

42
14) 3 80 / 2 90 /.
( , ).

0.12. ReadLn Read.


: - 20 16.
:
VAR a,b : Integer;
BEGIN
a:=20; b:=16;
WriteLn (a+b)
END.

VAR a,b : Integer;


BEGIN
ReadLn (a,b);
WriteLn (a+b)
END.

. -
36. , a b, ReadLn.
.
ReadLn "'", " ".
, , .
, ReadLn (a,b) .
,
, ReadLn .
20 ( ReadLn a),
, 16 Enter.
, ,
. Enter ,
ReadLn .
Enter 20 ,
a, 16 - b. ReadLn
- WriteLn. 36.
, . ReadLn
? , . ,
ReadLn , "":
, . ,
ReadLn
, .
, ReadLn ,
.
:
, .
, - .
. ,
.
:
kol_krol

kol_slon

norma_krol

norma_slon

vsego

:
VAR kol_krol,kol_slon,norma_krol,norma_slon,vsego :Integer;
BEGIN
norma_krol:=2;
norma_slon:=100;
ReadLn (kol_krol);
kol_slon:=3;
vsego := norma_krol * kol_krol + norma_slon * kol_slon;
WriteLn (vsego)
END.

43
, , .
. , , 60 ,
.
, ( norma_krol:=2 norma_slon:=100),
ReadLn. 60,
kol_krol ( kol_slon:=3 ).
: 420.
:

norma_krol:=2
norma_slon:=100
ReadLn (kol_krol)
kol_slon:=3
vsego:=norma_krol
WriteLn (vsego)


kol_krol

kol_slon

norma_krol

norma_slon

vsego

?
?
60
60
60
60

?
?
?
3
3
3

2
2
2
2
2
2

?
100
100
100
100
100

?
?
?
?
420
420

, , 5 ,
, 55 - 410.
, ReadLn
, , ,
. - ReadLn
, kol_krol:=60.
, .
ReadLn , : ReadLn . ,
, - , Enter.
, . ,
, .
ReadLn Read.
. ReadLn.
Read .

0.13.
ReadLn(kol_krol),
, -
. , - . .
, -
, - .
. 420.
, : 420 , 420 . ,
, , ,
. "" , "",
.
- , :
VAR kol_krol,kol_slon,norma_krol,norma_slon,vsego : Integer;
BEGIN
norma_krol:=2;
norma_slon:=100;
WriteLn ( ', , ' );
ReadLn ( kol_krol);
kol_slon:=3;
vsego := norma_krol * kol_krol + norma_slon * kol_slon;
WriteLn( ' ' ,vsego, ' ' );
ReadLn
END.
, , , ,
ReadLn ( kol_krol), , ,
-

44
420
ReadLn
. , ,
, .
ReadLn, WriteLn, , .
, ,
. Enter (
ReadLn END , ).
, , ReadLn. ( Alt-F5),
. ""
ReadLn.

15-16:
:
15) 20.
. .
16) , , . .

0.14.
:
VAR a : Integer;
BEGIN
a:=98;
WriteLn (a)
END.

VAR a : String;
BEGIN
a:=' !';
WriteLn (a)
END.

VAR a : Integer , a
, a:=98 a 98.
VAR a : String , a
() , , , ,
!

2(*fD6:u . a:=' !' a


! . WriteLn (a), a,
!
, ,
.
String "", "".
, .

, . ,
a:='!'; WriteLn(a); a:='!'; a:=' !'; WriteLn (a)
a
! ! !

! !
, ReadLn.
:
VAR a : String;
BEGIN
WriteLn (' - ');
ReadLn (a);
WriteLn (' ' ,a)
END.
, ReadLn, - ,
, Enter , .
:

45

0.15.
, :
:
, , ?
:

:
, . . ?
:
16
:
! 16 ! !
:
VAR imya
:String;
vozrast :Integer;
BEGIN
WriteLn (', , ?');
ReadLn (imya);
WriteLn (' , ', imya, ' . ?');
ReadLn (vozrast);
WriteLn ('! ' ,vozrast, ' ! !')
END.
, . ,
:
:
, , ?
:
!
:
, ! . ?
:
100
:
! 100 ! !
, . ,
. :
:
, , ?
:
!
:
, ! . ?
:
-2
:
! -2 ! !

17: : ,
( ) ( ).
:
365 , 12 .

0.16.
. ,
, , . :
x:=25
25
slovo:=
-
simvol:=!
- !
y:=(x+1) / (200*x - 0.3)
- 1 200 0.3

46

.1

1.1. IF

1.8. ,
( , )
().
, .
:
if
""
""
then
""
""
else
""
""
:

IF

a=28 THEN WriteLn (f)

ELSE

k:=44

a=28

k 44.
, , , a=28 , ,
WriteLn (f), k:=44 . ,
, , ,
( ).
, if ,
- . , if,
.
1. - 167 121. 2000,
, .
.
:
VAR a,b,y :Integer;
BEGIN
a:=167;
b:=121;
y:=a*b;
if y>20000
then WriteLn (' ')
else WriteLn (' ');
WriteLn (y)
END.
: 5 ,
, .

WriteLn (y). 5

2. - .
- .
a1 - , a2 - , bol - , V -
. :

47
1

VAR a1,a2 : Real;


BEGIN
ReadLn (a1,a2);
if a1>a2 then WriteLn (a1*a1*a1 : 15:5)
else WriteLn (a2*a2*a2 : 15:5)
END.
VAR a1,a2,V : Real;
BEGIN
ReadLn (a1,a2);
if a1>a2 then V:=a1*a1*a1
else V:=a2*a2*a2;
WriteLn (V : 15:5)
END.
VAR a1,a2,bol,V : Real;
BEGIN
ReadLn (a1,a2);
if a1>a2 then bol:=a1
else bol:=a2;
V:=bol*bol*bol;
WriteLn (V : 15:5)
END.

. ,
. ReadLn (a1,a2), .
3 2. , a1 3, a2 2,
if. , 3>2, bol:=a1, bol:=a2 .
bol 3. V:=bol*bol*bol V=3*3*3=27. WriteLn (V : 15:5) 27.00000 .
6 10, ,
6>10 , bol:=a2, bol:=a1 .
bol 10 1000.00000 .
, ,
.
, ,
, .

, .
, IV
. .
, , if
, - ,
.
if else. , if s<t then w:=a+1. ,
s<t, w:=a+1, ,
.
: .
. , "",
"".
-"":
VAR Slovo : String;
BEGIN
ReadLn (Slovo); { Slovo , }
if Slovo = '' then Slovo := '';
WriteLn (Slovo)
END.

48

1.2. IF
, ,
, .
, .
. . ,
, ,
. , ,
, , ,
, , , ,
, .
if ( 3.8),
. , ,
. :
IF THEN ELSE
? , , ,
, . ,
, . ,
, , . ,
.

,
,
, 1.1

, 0.9

>
>=
=
<
<=
<>
:

if 5*a+4 <= a*b then WriteLn (b) else a:=b+5

WriteLn (b)
a:=b+5
5*a+4 <= a*b
5*a+4
a*b
<=

- ,
- ,
- ,
- ,
- ,
- .

. ,
, . if ,
- . -
, , -
, else end. , end ,
ELSE .

IF

.5.1 , if :
THEN

, , .
. . :
IF

THEN

[ ELSE ]

, , .
: , if,
. , b:=6; if b+1>0 then s:=20 - b
6, 7. WriteLn. :

49
b:=6; WriteLn (b+1) . b 6, 7. ,
.
if:

a:=10; if a>2 then WriteLn ('!!!') else WriteLn ('!')


a:=4; if a>5 then a:=a+10 else a:=a-1; WriteLn (a)
s:=6; if s-8<0 then s:=s+10; WriteLn (s)
s:=6; if s<0 then s:=s+10; s:=s+1; WriteLn (s)

!!!
3
16
7

: , if
s:=s+1. s:=s+1 , s.

s:=s+10,

18-20:
, :
18. k:=20; k:=k+10; if k+10<>30 then k:=8 else k:=k-1; WriteLn (k)
19. k:=20; k:=k+10; if k+10 = 30 then k:=8 else k:=k-1; WriteLn (k)
20. p:=1; if p>0 then p:=p+5; Write (p); if p>10 then p:=p+1; Write (p)

21-23:
21. . , , . .
22. . , ,
, .
: . :
, . 1.5.
23. , , 100 -
. , N ?

1.3.
, :
WriteLn (' ');
ReadLn (a,b);
WriteLn (' ' ,a+b)
, :
WriteLn (' ');
ReadLn (a);
WriteLn (' ' ,a*a)
, ,
, .
:
VAR Otvet : String; . . . . .
BEGIN
WriteLn (' ?');
ReadLn (Otvet);
if Otvet = '' then . . . . else . . . .
then , else . ,
. , if
then else . ,
.
begin end
.
:
begin
WriteLn (' ');
ReadLn (a,b);
WriteLn (' ' ,a+b)
end

50
,
,
, , ,
, , if.
:
VAR Otvet :String;
a,b :Integer;
BEGIN
WriteLn (' - ?');
ReadLn (Otvet);
if Otvet = ''
then
begin WriteLn (' ');
ReadLn (a,b);
WriteLn (' ' ,a+b)
end
else
begin WriteLn (' ');
ReadLn (a);
WriteLn (' ' ,a*a)
end;
WriteLn (' ')
END.
. - ,
, "", "", ,
if .
, .
24: , 0.15. ,
, . 17,
: " ?" , " ".
17, - " ?" " ".
, , : " !".

1.4.
, ,
1.3. VAR, BEGIN END . BEGIN
END : WriteLn, ReadLn, if WriteLn. , ,
. ,
( - if ),
. , (then else, begin end) .
, ,
, , , , .
, , , , . ,
,
. , , ,
.
, . ,
:
a:=0; b:=0; c:=0; f:=4;
.

1.5. if.
if.
if, then else ,
if.
: ( -
). 28 30, , - .

51
: . 28, ,
. ? : 30, ,
.
:
VAR a : Real;
BEGIN
ReadLn (a);
if a>28 then if a<30

then WriteLn ('')


else WriteLn (' ')
else WriteLn (' ')

END.
then else? , ,
, if else, - else. :
d:=3; v:=10; if v<6 then if v<20 then d:=1 else d:=2
d - 1, 2 3? , if
else if v<6 if v<20 ? ,
else else. if,
- . else, else if
else, .
- . , else
if v<20 , d 3.
25: 1.2: .
, , .
: .
_____________ _ _____________
if if , . ,
, .
, , if
, if. .
" ". - .
. ,
, ,
, 140 . .
:
VAR Tsvet :String;
{}
Rost :Integer;
{}
BEGIN
WriteLn (' ?');
ReadLn (Tsvet);
WriteLn (' ');
ReadLn (Rost);
if (Tsvet ='') AND (Rost<140)
then WriteLn (' ')
else WriteLn (' ')
END.

{ <140}

, if , , ,
6, AND ( "",
""). if - 140 ,
, .
AND, , ,
.
if
. .
6

, AND ,
= <, , , , ,
. ,
. .

52
-
:
VAR a :Real;
BEGIN
ReadLn (a);
if (a>28) AND (a<30) then WriteLn ('')
else WriteLn (' ')
END.
" ".
.
:
if (Tsvet ='') OR (Rost<140) { <140}
OR "", "".
, OR , ,
.
if
. .
AND OR . :
if (a>2) OR (x=b) OR (c<>1) then k:=99 else k:=33
k:=99, ,
, k:=33.
AND OR NOT ( "",
""). if NOT(a>b) then... - , a b, ....
:
a:=2; b:=3; if NOT(a>b) then k:=1 else k:=0
k:=1, , 2>3.
, , ,
, .
, . ,
if NOT ((a>2) AND (b>3)) AND (s>8)) then... - ,
- a>2, b>3, s>8, ...
:

a:=8;
a:=8;
a:=8;
a:=8;

b:=6;
b:=6;
b:=6;
b:=6;

if (a>b) AND (b>7)


if (a>b) OR (b>7)
if (a<b) OR (b>7)
if
NOT (a=8)

then k:=1
then k:=1
then k:=1
then k:=1

else k:=0
else k:=0
else k:=0
else k:=0

k=0
k=1
k=0
k=0

26: " ". , ,


:
if
(Tsvet ='') AND ((Rost<180) OR (Rost>184))
then WriteLn (' ')
else
WriteLn (' ')
if . ,
. - :
. 28 30,
, 30 - , 0 28, ,
- .
:
VAR a : Real;
BEGIN
ReadLn (a);
if (a>28) AND (a<30)
if a>=30
if (a>=0) AND (a<=28)
if a<0

then WriteLn ('');


then WriteLn ('');
then WriteLn ('');
then WriteLn (' ')

53
END.

. if a>=30 a>=20, 25
:

a>=30 a>30, 30

27:
, - .
. :

1.6. Char
, case,
, .
: Integer LongInt ( ), Real ( ) String ( ).
- Char (). - Char - "", Character "".
VAR a,b: Char , a b
, . ( 2.5) a:='';
b:='+', a , b - +.
ReadLn (a) ,
a. WriteLn (b) .
, , :
VAR c1,c2,c3: Char;
BEGIN
ReadLn (c1,c2,c3);
WriteLn (c3,c2,c1)
END.
ReadLn , WriteLn .
ReadLn, , ,
.
Enter. , ReadLn
. , Char String. , -
.

1.7. case
,
. ,
:
VAR Otmetka: Integer;
BEGIN

54
WriteLn (' ?');
ReadLn (Otmetka);
CASE otmetka OF {: ...}
1,2 :WriteLn('!');
3
:WriteLn('');
4
:WriteLn('');
5
:WriteLn('!');
ELSE WriteLn(' ')
END
{ CASE}
END.
CASE ( "", "").
OF "". CASE :

1 2
'!'
3
''
4
''
5
'!'

' '
case
case Otmetka
, . ,
, . case .
, , else (
, 6). else
, .
case, ,
, if:
if (Otmetka=1) OR (Otmetka=2)
then WriteLn('!')
else if Otmetka=3
then WriteLn('')
else if Otmetka=4
then WriteLn('')
else if Otmetka=5
then WriteLn('!')
else WriteLn(' ')
case - , case,
. .1,
, - Integer, LongInt Char. ,
: -32768, ....4,5,6,7,8...
32767 Integer, ..... '','','','',''.... Char. , Real String
case , , .
, - case.
: 1) Real, 2) case
>, < ..
case:
VAR a,k : Integer;
BEGIN
a:=3;
case a*a+1 of { a*a+1 ...}
8,3,20 :k:=0;
7,10
:begin k:=1; WriteLn(k) end;
12 ..18 :k:=3
end
{ CASE}
END.
1. :
-, case , ,
10, 3*3+1. ,
( , , 3.4, ,
, ).
-, , , . begin k:=1; WriteLn(k) end

55
- - 12 ..18 . , 12,13,14,15,16,17,18.
.
-, else. ,
a:=3 a:=0, case, , ,
else, , .

28:
. , , , - ( ).
29: . ,
(+, -, *, /) . . :
ReadLn.

56

.2

2.1. GOTO. .
.
1.8. , . , ,
:
Write (' ');
Write (' ');
Write ('');
Write ('
')
:


. . . .

( ) ,
, . ,
Write (' ')
Write (' '), - Write (''), - Write ('
').
. , Write ('
')
Write (' '). ,
, Write (' ') Write (' ')
.
-,
:
m1:
Write (' ');
Write (' ');
Write ('');
Write ('
');
, m1
"" , Write ('
')
,
Write (' '), m1.
:
m1: Write (' ');
Write (' ');
Write ('');
Write ('
');
GOTO m1
GOTO - , " '", " ", m1 - .
- .
GOTO
, (,
.
.
, , , BEGIN
VAR. , , BEGIN LABEL
( "", "").
:
LABEL m1;
BEGIN
m1:Write (' ');
Write (' ');
Write ('');

57
Write ('
goto m1

');

END.
,
?
IV. ,
:
( )
Ctrl-Break ( , , Ctrl,
Break). .
, , .
, .
, Ctrl-F2.
, , . ,
Write (' ') GOTO m1.
:
LABEL 8;
VAR a,k : Integer;
BEGIN
k:=6;
a:=100;
goto 8;
a:=a+k;
k:=2*k;
WriteLn(a);
8: a:=a+1;
k:=k+10;
WriteLn(k,' ' ,a);
END.
16 101. :
k:=6;
a:=100;
goto 8;
a:=a+1;
k:=k+10;
WriteLn(k,' ' ,a);
a:=a+k; k:=2*k; WriteLn(a) , , .
30: , :
LABEL m1,met5;
VAR n,k : Integer;
BEGIN
n:=10;
k:=0;
WriteLn(' ' );
met5:Write(n);
n:=n+k;
goto m1;
n:=n+1;
m1: Write(' ');
ReadLn;
k:=k+1;
goto met5;
WriteLn(' ')
END.
, ,
.
, IV

. .

58

31-33:
:
31) : .....
32) 1000

999 998 997 996 ......


33) 100 50 25 12.5.... 8 .
: ReadLn
. - ,
.

2.2. if
goto if case.
: :
3 5 7 9
. , .
1

LABEL m;
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
m:
Write(f,' ');
f:=f+2;
if f<=9 then
goto m;

LABEL m1,m2;
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
m1: Write(f,' ');
f:=f+2;
if f>9 then goto m2
else
goto m1;
m2: Write(' ')
END.

Write(' ')
END.

:
Write(' ') f:=3 Write(f,' ') { 3} f:=f+2 {f 5} if f<=9 goto m Write(f,'
') {. 5} f:=f+2 {f = 7} if f<=9 goto m Write(f,' ') {. 7} f:=f+2 {f = 9} if f<=9 goto m Write(f,' ') {. 9}
f:=f+2 {f = 11} if f<=9
Write(' ')
goto . f<=9
goto, if Write(' '),
.
3
LABEL m1,m2,m3;
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
m1: if f<=9 then goto m3
else
goto m2;
m3: Write(f,' ');
f:=f+2;
goto m1;
m2: Write(' ')
END.

34-36:
34) 1 2 3 4 . . . 99 100 99 . . . 3 2 1.
35) " "- 6
0.003 . . . 0.999 1.000.

0.000 0.001 0.002

59
36) =2700, 900, 300, 100 . . . .. y=x/4 + 20 z=2y+0.23 , yz
1/.
: , ,
, , .
? , F7!

2.3. repeat
, -
, goto,
, , ,
.
- : repeat, while for. repeat.
repeat . . . . . until a+2>3*b "'.....'...", "......
, a+2 3*b".
repeat 3 5 7 9
. , repeat,
:
2
LABEL m1,m2;
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
m1:

m2:
END.

Write(f,' ');
f:=f+2;
if f>9 then goto m2
else
goto m1;
Write(' ')

REPEAT
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
repeat
Write(f,' ');
f:=f+2;
until f>9;
Write(' ')
END.

repeat

m1, until f>9 if f>9 then goto m2 else goto m1.


repeat:
REPEAT ; ;. . . ; UNTIL

repeat : ,
repeat until, , .
repeat :
, repeat,
until, , until. ,
..
, repeat
.

: , ,
. ,
"". , " "
.
, .
Slovo.
VAR Slovo : String;
BEGIN
repeat
WriteLn(' ');

60
ReadLn(Slovo);
WriteLn(Slovo, '!')
until Slovo='';
WriteLn(' ')
END.

37: .
.

38-39: repeat
.

40: 100- v=20/,


(s) s=vt, t .
h h=100 9.81t2/2. t, s h t=0, 0.2,
0.4, 0.6 , .

2.4. while
while:
WHILE DO

while "", do - "", - ,


. , while a>b do b:=b+1.
while :
, while. ,
, do.
. .. , while
.
, while, , while,
repeat, .
while 3 5 7 9,
repeat. , while,
2.2:
3
LABEL m1,m2,m3;
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
m1: if f<=9 then goto m3
else
goto m2;
m3: Write(f,' ');
f:=f+2;
goto m1;
m2: Write(' ')
END.

WHILE
VAR f : Integer;
BEGIN
Write(' ');
f:=3;
while f<=9 do
begin
Write(f,' ');
f:=f+2;
end;
Write(' ')
END.

, do begin Write(f,' '); f:=f+2; end.


.
.
, while f<=9 while f<9 , , , ,
. .
( while f<9)
. : f f<9 (
: true - false - ,
).

61

41: while
, .

900, 893, 886, 879 ..

2.5. repeat while


:
repeat , , while .
while , do. repeat ,
repeat until, .
,
k:=8;
repeat k:=1 until 3>2;
WriteLn(k)
1.

k:=8;
while 2>3 do k:=1;
WriteLn(k)
8.
while , repeat.

, . ,
, begin end, repeat.

2.6. for
3 5 7 9, repeat 4 .
while. , , repeat while, ,
. , ,
. for.
: 200 .
goto. :
metka: WriteLn('');
goto metka
, 200 . ,
goto if. ,
. - , i.
:
i:=1;
metka: WriteLn('');
i:=i+1;
{ i 1}
if i<=200 then goto metka
END.
i 1, 1.
if, 2<=200 , goto
metka. 3<=200 .. 199- 200<=200
, goto metka. 200- 201<=200
, .
"" - WriteLn('').
, "" 200 .
,
, . .
, , ,
for,
.

62
LABEL
m1,m2;
VAR i : Integer;
BEGIN i:=1;
m1: if i>200 then goto m2;
WriteLn('');
i:=i+1;
goto m1;
m2:
END.

VAR i : Integer;
BEGIN
for i:=1 to 200 do
WriteLn('')

END.

for "", "". to "", "". do


"", "". for i:=1 to 200 do - : i, 1
200, , do. , while.
, do, , , .
for:
FOR := 1 TO 2 DO

: for j:=a+b to 2*s do k:=k+1.


:
- (. 1.7 1.8), ,
,
1 2 - , - .
for:
1, ( i)
. 2 i. i > 2, for
, . ,
do. i 1
2. i > 2, for ,
, do, i 1 ..
i , , ""
. . :
10 11 12 . . . . . 200
:
VAR i : Integer;
BEGIN
for i:=10 to 200 do
begin
Write(i);
Write(' ')
end
END.
do .
for ?:
100 99 98 . . . . . 40
, for , . ,
for i:=100 to 40, for i:=100 downto 40. downto - "'",
" ". ,
i > 2, i < 2.
for:
FOR

:=

TO DOWNTO

DO

63
TO DOWNTO ,
.
42: for:
: -5 -4 -3 -2 -1 0 1 2 3 4 5 : 5 4 3 2 1 0 -1 -2 -3 -4 -5

64

.3

, , ,
, .
. , , ,
, .

3.1.
: 40 . , .
.
:
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;
{ }
V:=S*visota;
{}
WriteLn(S, ,V)
40 ,
for:
VAR i, dlina, shirina, visota, S, V: Integer;
BEGIN
for i:=1 to 40 do begin
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;
V:=S*visota;
WriteLn(S, ,V)
end {for}
END.
, 1.4 ,
end begin, for.
, . ,
. , end, {for}.
, , ,
:
VAR i, dlina, shirina, visota, N, S, V : Integer;
BEGIN
WriteLn( );
ReadLn (N);
{N - }
for i:=1 to N do begin
WriteLn( , );
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;
V:=S*visota;
WriteLn( =,S, =,V)
end
END.
.
20*15*4, 30*20*5 10*5*3. N=3
for . ReadLn
(dlina, shirina, visota), :
=300 =1200
=600 =3000
=50 =150

65

43: N . .

3.2.
1.2 , . ,
V:=S*visota V:=S+visota, :
=300 =304
=600 =605
=50 =53
for i:=1
=300 =1200
=600 =3000

to N for i:=2 to N :

. ,
1 2 , 2 3? , ,
, , .

44-45:
, ,
44) for i:=1 to N do begin ReadLn (dlina, shirina,
45) WriteLn( =,S, =,V)

visota)
end

,
.

3.3.
1: .
, .
, :
c:=0;
{ }
m:
ReadLn(a);
{ }
if a>0 then c:=c+1;
WriteLn(' - ' ,c);
goto m
: 2.6 i, .
c. . c:=c+1. 1. if a>0 then .
, c ,
. 1 , .
8, -2, 10 . . . :

c:=0
ReadLn(a)
if a>0 then c:=c+1
WriteLn(' - ' ,c)
goto m
ReadLn(a)
if a>0 then c:=c+1
WriteLn(' - ' ,c)
goto m
ReadLn(a)
if a>0 then c:=c+1
WriteLn(' - ' ,c)
goto m

?
8
8
8
8
-2
-2
-2
-2
10
10
10
10

0
0
1
1
1
1
1
1
1
1
2
2
2

, ,
. , ?

66
. .
2: 200 . ,
.
:
VAR c,i :Integer;
a :Real;
BEGIN
c:=0;
{ }
for i:=1 to 200 do begin
ReadLn(a);
if a>0 then c:=c+1
end {for};
WriteLn(' - ' ,c)
END.
: , .
for
ReadLn(a);if a>0 then c:=c+1 200 ,
. WriteLn .
: , 200
. 3 4.
.

1)
2)
3)
4)
5)

46: ,
c:=0 c:=10.
c:=c+1 c:=c+2.
end {for} WriteLn .
c:=0 for .
for ReadLn .

3: . "/".
, "W" ":"
.
: W Dv - W
, i - , .
:
VAR i,cW,cDv,procent_W, procent_Dv
simvol
BEGIN
i:=0; cW:=0; cDv:=0;
repeat
ReadLn (simvol);
i:=i+1;
case simvol of
'W':cW:=cW+1;
':' :cDv:=cDv+1
end
until simvol = '/';
procent_W
:=Round(100*cW/i);
procent_Dv
:=Round(100*cDv/i);
WriteLn(procent_W,' ',procent_Dv)
END.

: Integer;
:Char;
{ }
{ }
{ }
{ }
{ W, W}
{ :, :}
{ /}
{ W}
{ :}

47: N . ,
, 10.
48: . , ,
13. .
, ReadLn(a,b).

67

3.4.
, . ,
:
s:=0;
{ . , }
m:
ReadLn(a);
s:=s+a;
{ }
WriteLn(=, s);
goto m;
8, 4, 10 . . . :

s:=0
ReadLn(a)
s:=s+a
WriteLn(=' ,s)
goto m
ReadLn(a)
s:=s+a
WriteLn(=' ,s)
goto m
ReadLn(a)
s:=s+a
WriteLn(=' ,s)
goto m
.

?
8
8
8
8
4
4
4
4
10
10
10
10

0
0
8
8
8
8
12
12
12
12
22
22
22

=8

=12

=22

, s a, .
, 1 c:=c+1, -
s:=s+a.
: N . .
:
VAR i,N
:Integer;
a,s
:Real;
BEGIN
ReadLn(N);
s:=0;
for i:=1 to N do begin
ReadLn(a);
s:=s+a
end {for};
WriteLn( ' ,s:20:10)
END.

1)
2)
3)
4)
5)
6)
7)

49: N=2, a=5 3. 8. , :


s:=0 s:=10.
s:=s+a s:=s+a+1.
end {for} WriteLn .
s:=0 for .
for ReadLn .
s:=s+a end {for} .
for i:=1 to N for i:=2 to N.

50-52: :
50) 40 . . .
51) .
52) N .

68

3.5.

, . 1.7, case for.
, 3.3, .
, :
for i:=1 to 5 do begin
a:=9;
if i*i = a then for k:=5 to 8 do Write(k)
else WriteLn(1997);
end {for}
:
1997
1997
56781997
1997

3.6.
- . :
1*1=
2*1=
3*1=
4*1=
5*1=
6*1=
7*1=
8*1=
9*1=

1
2
3
4
5
6
7
8
9

1*2=
2*2=
3*2=
4*2=
5*2=
6*2=
7*2=
8*2=
9*2=

2
4
6
8
10
12
14
16
18

1*3=
2*3=
3*3=
4*3=
5*3=
6*3=
7*3=
8*3=
9*3=

3
6
9
12
15
18
21
24
27

1*4=
2*4=
3*4=
4*4=
5*4=
6*4=
7*4=
8*4=
9*4=

4
8
12
16
20
24
28
32
36

1*5=
2*5=
3*5=
4*5=
5*5=
6*5=
7*5=
8*5=
9*5=

5
10
15
20
25
30
35
40
45

1*6=
2*6=
3*6=
4*6=
5*6=
6*6=
7*6=
8*6=
9*6=

6
12
18
24
30
36
42
48
54

1*7=
2*7=
3*7=
4*7=
5*7=
6*7=
7*7=
8*7=
9*7=

7
14
21
28
35
42
49
56
63

1*8=
2*8=
3*8=
4*8=
5*8=
6*8=
7*8=
8*8=
9*8=

8
16
24
32
40
48
56
64
72

1*9=
2*9=
3*9=
4*9=
5*9=
6*9=
7*9=
8*9=
9*9=

9
18
27
36
45
54
63
72
81

-
1*1=1

:
1
a:=1;
b:=1;
proizv:=a*b;
Write(a, * ,b, = ,proizv)
Write 5 :

a,

*,

b,

=,

proizv
. :
1*1=

1 1*2=

2 1*3=

3 1*4=

4 1*5=

5 1*6=

6 1*7=

7 1*8=

8 1*9=

, 9 ,
1. .
, 9 1, b:=1
. for:
2
a:=1;
for b:=1 to 9 do begin
proizv:=a*b;
Write(a, * ,b, = ,proizv,

69
end {for}
, , Write .
, .
- - , .
2 9 , - a. ,
2 for , 1.
3
for a:=1 to 9 do
for b:=1 to 9 do begin
proizv:=a*b;
Write(a, * ,b, = ,proizv,
end {for b}
end {for a}

3 .
,
:
VAR a,b,proizv: Integer;
BEGIN
for a:=1 to 9 do begin
WriteLn;
for b:=1 to 9 do begin
proizv:=a*b;
Write(a, * ,b, = ,proizv:3,
end {for b}
end {for a}
END.

{1}
{2}
{3}
{4}
{5}
{6}
{7}
{8}
{9}
{10}

WriteLn , .
:3 , .
, (, 4 25)
, .
, , ,
, . ( 4 5) 9 , ( 6, 7
8) - 81 , 5 9 .

53-56:
53) - 3 8, 0 7. , 36, 44, 80.
54) , 1,2,3.
, 2123, 3312, 1111.
55) .
56) , ,
- 1123, 1223, 2222 .., 3322.

3.7.
: .
: .
: .
. , .
, , , , .
:
, , max. .
( chislo) max. , max
.
10 :
VAR i, chislo, max :Integer;

70
BEGIN
ReadLn(max);
{ - }
for i:=2 to 10 do begin
{ :}
ReadLn(chislo);
{ }
if chislo>max then max:=chislo { , , }
end {for};
WriteLn(max)
{ }
END.

57: N . ?
: .
58: . ,
, 40 .?

71

.4
1.8. , ,
, .
- , .
, , ,
, ,
.

4.1.
, . ,
:
USES CRT;
BEGIN
Sound(300)
END.
:
, ,
Uses CRT. , , 5.1, .
Sound(300)
300 (). Sound , . ,
, , . Sound(300) - . Sound(6000) -
, , . Sound(40) - , .
, , . ?
? ! , , ,
. - . ,
- . , , .
. -
. - . , NoSound:
USES CRT;
BEGIN
NoSound
END.
NoSound ( , ), . :
, NoSound. !
:
USES CRT;
BEGIN
Sound (300); Delay (2000); NoSound
END.
Delay (2000). ,
. , 2000 ,
, 2 . Delay (1000) 1 , Delay (500) -
.. ( ,
).
, Sound (300) . Delay (2000)
2 . , .
2 NoSound. . ,
300 2 .
:

72
USES CRT;
BEGIN
Sound(900);Delay(1000);Sound(200);Delay(3000);NoSound
END.
900 1 , Sound(200)
900 200 , 3 .
Sound Delay
. , :
USES CRT;
VAR hz: Integer;
BEGIN
hz:=60;
while hz<800 do begin
Sound(hz);
Delay(1000);
hz:=hz+40
end;
NoSound
END.
, Sound, :











Sound(523)
Sound(554)
Sound(587)
Sound(622)
Sound(659)
Sound(698)
Sound(740)
Sound(784)
Sound(831)
Sound(880)
Sound(932)
Sound(988)

59-63:
59) Delay(1000) hz:=hz+40
(). .
60) , : - - - .
61) ,
, .
62) . ,
, 10000-20000 . .
,
, , .
, .
ReadLn.
63) ,
.

4.2.
: ,
. ,
: ( )
( ). .
( , ):

73
a
i
r

...
.-.
----

b
j
s
q

-
.--
--.-

w
k
t
,x

.--.-..-

g
l
u
y

--.
.-..
..-.--

d
m
f

-..
-..-.
..-..

e
n
h

.
-.
.
..--

v
o
c

- z --..
--- p .--.
-.-. ---.
.-.-

PIPING
. - 100 , - 200, - 80,
- 300. , 900 .
, :
Sound(900);Delay(100); NoSound; Delay(80)
, :
Sound(900);Delay(200); NoSound; Delay(80)
:

1
USES CRT;
BEGIN
{ P:}
Sound(900); Delay(100); NoSound; Delay(80);
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
{ I:}
Sound(900); Delay(100); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
{ P:}
Sound(900); Delay(100); NoSound; Delay(80);
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
{ I:}
Sound(900); Delay(100); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
{ N:}
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
{ G:}
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(200); NoSound; Delay(80);
Sound(900); Delay(100); NoSound; Delay(80);
Delay(300);
END.

{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}

:
, , .
, , .
, :

2
USES CRT;
PROCEDURE tochka;
BEGIN Sound(900); Delay(100); NoSound; Delay(80) END;
PROCEDURE tire;
BEGIN Sound(900); Delay(200); NoSound; Delay(80) END;

74

BEGIN
{ P:}
{ I:}
{ P:}
{ I:}
{ N:}
{ G:}
END.

tochka; tire; tire; tochka; Delay(300);


tochka; tochka;
Delay(300);
tochka; tire; tire; tochka; Delay(300);
tochka; tochka;
Delay(300);
tire; tochka;
Delay(300);
tire; tire; tochka;
Delay(300);

2 1. ,
.
1 . :
Sound(900); Delay(100); NoSound; Delay(80);
{}
Sound(900); Delay(200); NoSound; Delay(80);
{}
: tochka tire.
2. BEGIN,
:
PROCEDURE tochka;
BEGIN Sound(900); Delay(100); NoSound; Delay(80) END;
PROCEDURE tire;
BEGIN Sound(900); Delay(200); NoSound; Delay(80) END;
, tochka tire. tochka
tire , , BEGIN. ,
BEGIN, ,
, .
.
:
PROCEDURE ; BEGIN ; ; ... END

PROCEDURE , .
, . , , .
64: , - (------------).
. , 2
:
{ P:} tochka; tire; tire; tochka; Delay(300);
{ I:} tochka; tochka;
Delay(300);
:
PROCEDURE P;
BEGIN tochka; tire; tire; tochka; Delay(300) END;
PROCEDURE I;
BEGIN tochka; tochka;
Delay(300) END;
, ,
. :

3
USES CRT;
PROCEDURE tochka;
BEGIN Sound(900); Delay(100); NoSound; Delay(80) END;
PROCEDURE tire;
BEGIN Sound(900); Delay(200); NoSound; Delay(80) END;
PROCEDURE P;
BEGIN tochka; tire; tire; tochka; Delay(300) END;
PROCEDURE I;
BEGIN tochka; tochka;

Delay(300) END;

75

PROCEDURE N;
BEGIN tire; tochka;

Delay(300) END;

PROCEDURE G;
BEGIN tire; tire; tochka;

Delay(300) END;

BEGIN
P;I;P;I;N;G
END.
. ,
, . ,
. , BEGIN, P.
BEGIN, , P - , (
). , , , tochka. , ,
tochka - , ( ). ,
.
. , , , 6.6.
tochka, P (
P). . tire. ..
65: -. 1 .
- (. ). 2 -
.

4.3.
. .
:
{ }
BEGIN
{ }
END.
, , VAR,
LABEL, USES, PROCEDURE , .
, .
II ,
.
. . , ( tochka, tire .),
.
: Write, WriteLn, Read, ReadLn, Sound, Delay, NoSound. ,
7 , ,
. ,
. goto, if,
case, for, while, repeat, , with
.

4.4. Halt Exit


Halt , .
Exit , .
, END , .
Halt , END . :

, ,

76
BEGIN

Write(1); Write(2); Halt; Write(3)

END.

12,
PROCEDURE a; BEGIN Write(6); Halt; Write(7); END;
BEGIN Write(2); a; Write(3); Halt; Write(4) END.
26.
Exit, ,
, . : Halt Exit ,
. ,
PROCEDURE a; BEGIN Write(6); Exit; Write(7); END;
BEGIN Write(2); a; Write(3); Halt; Write(4) END.
263.
Exit , , Halt,
.

66:
. , , ,
.
PROCEDURE ATOS;
BEGIN WriteLn (' - ')
END;
PROCEDURE ARAMIS;
BEGIN WriteLn (' , , -!')
END;
PROCEDURE PORTOS;
BEGIN WriteLn (' ! , ?');
Aramis;
WriteLn (' , ! , .') END;
PROCEDURE DARTANIAN;
BEGIN WriteLn (' , - ?');
Exit;
WriteLn (', ?');
Portos
END;
BEGIN
WriteLn (', , - ? - ?');
Atos;
WriteLn (' , , ?');
Portos;
WriteLn (' , ?');
dArtanian;
WriteLn ('! - !!!');
Halt;
WriteLn (' , !');
END.
, . ,
.
,
. , .2.

77

.5
, ,
.

5.1.
1.5 , ,
,
( - 8).
: Write, WriteLn, Read, ReadLn, Sound, Delay, NoSound, Exit, Halt.
, , ,
. . , , ,
? , -
. , ,
. , ,
Sound NoSound?
. ,
. ,
, , .
CRT . Graph
.
.
, ,
- .
? . ,
- USES CRT, , - USES Graph. USES
, . , USES CRT
CRT, ,
.
, .
, ,
, , .
4.3.

5.2. Graph,

Graph , .
USES Graph, ,
, , ,
, , . ,
, .
CRT ,
. 6.9 .
Graph.
5.2.1.

() - .
.
.
, 25 80 , .

. , .
.
,
- .
8

78
2.4. ,
- ,
.
, ? , , .
-
.
, .
, . ,
.
5.2.2.

, ,
USES Graph.
, , ,
. (, ,
) InitGraph. ,
, CloseGraph.
( .
3 4.)
,
, , ,
:
USES
Graph;
VAR
Device, Mode : Integer;
BEGIN
WriteLn( );
{ :}
ReadLn;
Device:=0;
InitGraph(Device, Mode, < >);
Circle(100,80,50); { . }
ReadLn;
{ , :}
CloseGraph;
WriteLn( );
ReadLn
END.
: InitGraph
Integer ( Device Mode).
InitGraph .
, , Device ( CGA, EGA,
VGA ), Mode . , ,
Device := 0
.
- , .
<>, , ,
, , .
egavga.bgi, BGI. TP c,
:

InitGraph(Device, Mode,

c:\TP\BGI)

, ,
. , , , .
(File not found (GRAPH.TPU)),
IV. , .
, .

5.3.
,
640 480 .
, .

79
. :
640

1 2 3 4 5 6 7 8 9 101112 13141516
1
2
3
4
5
6
7
8
9
10
11
12

480

:
PutPixel(14,6, Yellow)
Rectangle(4,2,16,10)
, PutPixel , Rectangle . , , .
PutPixel Rectangle . PutPixel , - , - (). Rectangle
- , -
( ). , - .
, .
Graph 16 . :
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Black
Blue
Green
Cyan
Red
Magenta
Brown
LightGray
DarkGray
LightBlue
LightGreen
LightCyan
LightRed
LightMagenta
Yellow
White

-
-
-

. , LightMagenta
.
, ,
. , PutPixel(14,6, Yellow) PutPixel(14,6, 14).
:

y
x

80

, . . , 2.2
.
, , , ,
:
0

50

100

150

200

250

300

50

100

150

200

USES
Graph;
VAR
Device, Mode: Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
PutPixel(50,100,White);
Rectangle(150,150,50,200); { }
Circle(200,100,50);
{}
Line(100,50,250,150);
{ }
ReadLn;
CloseGraph
END.
: Line. , ,
. - .
- ( ), - .
, .
Circle, - , - .

81
=200, =150, :
40
100

Ellipse. - Ellipse(200,150,0,360,100,40).
, , 0 , 90, 360 , 180.
ClearDevice .
67: :

5.4. . .
. , , ,
, SetLineStyle. - SetLineStyle(0, 0, ThickWidth).
. , SetLineStyle(0, 0, NormWidth).
SetLineStyle (,
.). 0 1, 2 3 , .
.
. ,
(PutPixel), -.
SetColor. : SetColor(Yellow) .
:
Circle(100,100,20);

{ ,
{ }

SetColor(Yellow);
Circle(150,100,20);
{ }
SetLineStyle(0, 0, ThickWidth);
Circle(200,100,20); { }
SetColor(Blue);
SetLineStyle(0, 0, NormWidth);
Circle(250,100,20); { }
, ( )
. :

82

, , :

? SetFillStyle. , SetColor
, , SetFillStyle ,
. , SetFillStyle(1, Green)
. .
FloodFill. , FloodFill(200, 150, Blue)
:
=200 =150 ,
SetFillStyle ( - ), .
, ,
FloodFill, . , ,
.
: :
SetColor(Yellow);
SetFillStyle(1, Red);
Rectangle(200,50,300,150);
FloodFill(250, 100, Yellow)

FloodFill(250, 100, Yellow) , FloodFill(250, 200, Yellow).


, .
- ,
FloodFill(250, 100, Yellow), , ,
SetFillStyle.
, .
, , ,
:


FloodFill( , ,Blue ). :

SetFillStyle(1, Yellow)

83

, FloodFill ,
.
, - .
SetFillStyle - 2, 3 .

68: 5.3. - ,
, . WriteLn
.

5.5.
, ,
, , .
? : ,

.
: 10 100
50, 80, 110, 140, , 290.
, 30.
:
Circle( 50,100,10);
Circle( 80,100,10);
Circle(110,100,10);
Circle(140,100,10);
Circle(170,100,10);
Circle(200,100,10);
Circle(230,100,10);
Circle(260,100,10);
Circle(290,100,10);


. ,
IV.
, 9 ,
30.
.
, , . ,
repeat. :
USES
Graph;
VAR
x, Device, Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
x:=50;
repeat
Circle(x,100,10);
x:=x+30;
until x>290;
ReadLn;

84
CloseGraph
END.

69:. , ,
, , , .
70:. .
71:. .
. , ,
. - x.
USES
Graph;
VAR
x, y, Device, Mode : Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
x:=50;
y:=20;
repeat
Circle(x,y,10);
x:=x+30;
y:=y+20;
until x>290;
ReadLn;
CloseGraph
END.
, R, Integer.

72:. .
73:. . ,
, .
74:. -. 50,
- , 2-3 ,
-. (Yellow).
75:. x, y R, .
76:. , , .
77:. .
78:. .
79:. .
80:. .
, : ,
.., :
81:. .
82:. . 69 .
.
: .
, ,
, .
83:. .

84:. .

5.6.
? . Random
0.9. WriteLn(Random(100)) , - , ,

85
100. , WriteLn (500 + Random(100))
500 599.
.
(, 1000). PutPixel.
? Random. 640480 ,
:
PutPixel (Random(640), Random(480), Random(16))
16 , 0 15.
, 1000, for:
for i:=1 to 1000 do

PutPixel (Random(640), Random(480), Random(16))

, ,
. ,
( ), Random
Randomize. :
Randomize;
for i:=1 to 1000 do

PutPixel (Random(640), Random(480), Random(16))

85:. . 20 .
86:. . .
87:. . .

5.7.
1.8.
.
, , . ,
, , .
, .. :
USES
Graph;
VAR
x, Device, Mode : Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
ReadLn;
{ - , ,
, }
x:=40;
repeat
SetColor(White);
Circle(x,100,10); { }
SetColor(Black);
Circle(x,100,10); { }
x:=x+1
{ }
until x>600;
CloseGraph
END.
,
- .
- .

Delay - .

88:. . ,
(x:=x+2), Delay.
89:. .
90:. , .
91:. .
92:. , .

86
, , ,
. .

93:. . .
, . (
), .
94: , , 2.3.
. 100- v=20/.
(s) s=v*t, t . h
h=100 9.81*t2/2. , , ( ).
. , ,
2.3. . ,
.
: , .
, , , , .
100 , 20 ,
. , , - .
400 , 80 , h=4*(100 9.81*t2/2).
95 (): : .
? .
. .


v . .
: s=v*t*cos h=v*t*sin 9.81*t2/2 (. ). , ,
.

Graph.
.4.

87

.6

.
( ).
, , ,
IV, .
0.11 . ,
. , ,
.

6.1.
.
: :
1) :

2) ( 5).
3) ( )
( ).
4) .
5) . .

6.2. -
, ( )
. (P, I, N

88
(tochka, tire), - .. .
- , - ..
, , - ,
. 4.2 P, I, P, I, N, G. .
:
1)
2)
3)
4)
5)
6)
, , , ,
. ,
(), ().
, . :

Landscape

Music

Flying_Saucer
, ,
, :
Music. -,
Sound Delay. .
Flying_Saucer. ,
. .
Landscape. . , .
. , , .
, . - ,
. .
, , , , , .
:
1)
2)
3)
4)
5)
6)
7)
8)
9)
10)
, .
, , . :

House

Tree
, ,
, .
. ,
, ,
.
, :
-

-

- ,

- . ,


-

-

-

89
: Tree
. , , ? :
, .

6.3.
, , , ,
, .
.
,
, , ,
, : . -
, , ,
. ,
. , ,
- , ,
, .
, ,
. :
USES Graph,CRT;
VAR Device, Mode :Integer;
PROCEDURE Landscape;
BEGIN WriteLn( )
END;
PROCEDURE Music;
BEGIN WriteLn( )
END;
PROCEDURE Flying_Saucer;
BEGIN WriteLn( ) END;
BEGIN
Device:=0;
InitGraph(Device, Mode, < ..>);
DirectVideo:=false;
Landscape;
{ }
WriteLn( 3 );
{ }
Music;
{ }
Flying_Saucer;
{ }
Music;
{ }
WriteLn( );
{ }
ReadLn;
CloseGraph
END.
. Graph CRT,
. WriteLn . - ,
DirectVideo:=false. .
,
.
. ,
. , ( ,
), , .
, :

3




, .
USES Graph,CRT;

90
VAR Device, Mode :Integer;
PROCEDURE Tree;
BEGIN WriteLn( )
PROCEDURE House;
BEGIN WriteLn( )
PROCEDURE Landscape;
BEGIN
WriteLn( );
WriteLn( );
WriteLn( );
WriteLn( );
WriteLn( );
Tree;
Tree;
Tree;
House;
House;
WriteLn( );

END;
END;

{ }
{ }
{ }
{ }
{ }
{ }
{ }
{ }
{ }
{ }
END;

PROCEDURE Music;
BEGIN WriteLn( )
END;
PROCEDURE Flying_Saucer;
BEGIN WriteLn( ) END;
BEGIN
Device:=0;
InitGraph(Device, Mode, < ..>);
DirectVideo:=false;
Landscape;
{ }
WriteLn( 3 );
{ }
Music;
{ }
Flying_Saucer;
{ }
Music;
{ }
WriteLn( );
{ }
ReadLn;
CloseGraph
END.
: , ,
. , .
Landscape ,
. ( , 4.2.)
Landscape , .
,
( ):











3




. . ,
.

91

6.4.
0.11 , . ,
,
. , -
.
3 -.
.
USES
Graph;
VAR
x, Device, Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
ReadLn;
repeat
{ }
{ :}
x:=40;
{ }
repeat
{ }
SetColor(White);
Circle(x,100,10); { }
SetColor(Black);
Circle(x,100,10); { }
x:=x+2
{ }
until x>600;
{ }
{ :}
x:=600;
{ }
repeat
{ }
SetColor(White);
Circle(x,100,10); { }
SetColor(Black);
Circle(x,100,10); { }
x:=x-2
{ }
until x<40
{ }
until 8>9
END.

{ , }

, , .
2 6. - , , . .
, , ,
, , .
, :
USES
Graph;
VAR
x, Device, Mode, lev, prav, shag : Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, < >);
ReadLn;
lev:=40; prav:=600; shag:=2;
repeat
x:=lev;
repeat
SetColor(White);
Circle(x,100,10);
SetColor(Black);
Circle(x,100,10);
x:=x+shag
until x>prav;
x:=prav;
repeat
SetColor(White);
Circle(x,100,10);
SetColor(Black);

92
Circle(x,100,10);
x:=x-shag
until x<lev
until 8>9
END.
, , 2 6 .
, , , ,
, .

6.5.
.
.
. ,
.

, , , ! ?
10
. , 10 . 10
. 10 100 ,
10 . , .
10 , -?
, ,
.
, ( ).
, : VAR
y_goriz. y_goriz:=240.
Line (0, y_goriz, 640, y_goriz). .
,
.
. . ?
. . . ,
. .
. - ,
, .
, ,
.
.
, .
, - 640480. ,
.
. Line(0,240,640,240). ,
. 0 640 ,
. y_goriz
240. :

y_goriz:=240;
Line (0, y_goriz, 640, y_goriz)
y_goriz:=240 , y_goriz
.
, , . .
, :
PROCEDURE Tree;
BEGIN
SetColor(White);
{ :}
Ellipse (100,400,0,360,15,30);
SetFillStyle(1,LightGreen);
FloodFill(100,400,White);
{ :}

93
Rectangle (97,430,103,460);
SetFillStyle(1,Brown);
FloodFill(100,440,White);
END;
, , ,
, .
, . x_tree y_tree
. :
PROCEDURE Tree;
BEGIN
SetColor(White);
{ :}
Ellipse ( x_tree, y_tree, 0, 360,15,30);
SetFillStyle(1,LightGreen);
FloodFill(x_tree, y_tree, White);
{ :}
Rectangle (x_tree - 3, y_tree + 30, x_tree + 3, y_tree + 60);
SetFillStyle(1,Brown);
FloodFill (x_tree, y_tree + 40, White);
END;
, ,

Tree : x_tree := 100, y_tree:= 400.


,
.
. :
PROCEDURE House;
BEGIN
SetColor(White);
{ :}
Rectangle (300,400,340,440);
SetFillStyle(1,LightBlue);
FloodFill (301,401,White);
{ :}
Rectangle (315,410,325,420);
SetFillStyle(1,DarkGray);
FloodFill (320,415, White);
{ :}
Line(295,400,345,400);
Line(295,400,320,370);
Line(345,400,320,370);
SetFillStyle(1,Red);
FloodFill (320,399, White);
END;
.
House .
:
USES Graph,CRT;
VAR Device, Mode, i
y_goriz,
x_tree, y_tree, x_house, y_house,
x_tar, y_tar,
shirina_tar, visota_tar

: Integer;
: Integer;

PROCEDURE Tree;
BEGIN
SetColor(White);
{ :}
Ellipse ( x_tree, y_tree, 0, 360, 15, 30);
SetFillStyle(1,LightGreen);
FloodFill(x_tree, y_tree, White);
{ :}
Rectangle (x_tree - 3, y_tree + 30, x_tree + 3, y_tree + 60);

x_house:=300; y_house:=400.

94
SetFillStyle(1,Brown);
FloodFill (x_tree,
y_tree + 40,
END;

White);

PROCEDURE House;
BEGIN
SetColor(White);
{ :}
Rectangle (x_house,
y_house,
x_house+40, y_house+40);
SetFillStyle(1,LightBlue);
FloodFill (x_house+1,
y_house+1,
White);
{ :}
Rectangle (x_house+15, y_house+10, x_house+25, y_house+20);
SetFillStyle(1,DarkGray);
FloodFill (x_house+20, y_house+15, White);
{ :}
Line(x_house-5,
y_house,
x_house+45, y_house);
Line(x_house-5,
y_house,
x_house+20, y_house-30);
Line(x_house+45, y_house,
x_house+20, y_house-30);
SetFillStyle(1,Red);
FloodFill (x_house+20, y_house-1,
White);
END;
PROCEDURE Landscape;
BEGIN
{ : }
Line(0, y_goriz, 640, y_goriz);
{ : }
SetFillStyle(1,Blue);
FloodFill(10,10,White);
{ : }
SetColor(Yellow);
Circle(500,100,30);
SetFillStyle(1,Yellow);
FloodFill(500,100,Yellow);
{ : }
for i:=1 to 100 do PutPixel (Random(640),Random(y_goriz),Random(16));
{ : }
x_tree:=100;y_tree:=400;
Tree;
x_tree:=300;y_tree:=300;
Tree;
x_tree:=550;y_tree:=380;
Tree;
{ : }
x_house:=300; y_house:=400;
House;
x_house:=470; y_house:=300;
House;
{ : }
SetFillStyle(1,Green);
FloodFill(10,470,White);
END;
PROCEDURE Music;
BEGIN
Sound(200);Delay(1000);
Sound(500);Delay(1000);
Sound(300);Delay(1000);
NoSound
END;
PROCEDURE Flying_Saucer;
BEGIN
{ .
,
}
x_tar:=100; y_tar:=40; shirina_tar:=30; visota_tar:=15;
repeat
{ }
SetColor(White);

95
Ellipse (x_tar, y_tar, 0, 360, shirina_tar, visota_tar);
Delay(20);
{ }
SetColor(Blue);
Ellipse (x_tar, y_tar, 0, 360, shirina_tar, visota_tar);
y_tar:=y_tar+1
until y_tar > y_goriz;
{ : }
SetColor(White);
Ellipse (x_tar, y_tar, 0, 360, shirina_tar, visota_tar);
END;
BEGIN
Device:=0;
InitGraph(Device, Mode, '< .>);
y_goriz:=240;
Landscape;
{ }
Delay(3000);
{ }
Music;
{ }
Flying_Saucer;
{ }
Music;
{ }
SetFillStyle(1,Yellow);
{ }
FloodFill (x_house+20, y_house+15, White);
{ }
ReadLn;
CloseGraph
END.

6.6. ,

(0.6), , ,
. , ,
, , .
?
VAR.
,
, .
. VAR .
, , Music Flying_Saucer, , i
( for Landscape) , ,
. y_goriz,
( repeat
y_goriz:=240), - (
Line(0, y_goriz, 640, y_goriz) ). -
,
, .
. , Tree
Landscape, Landscape
Tree , .
, , , , , P1
P2, P2 P1. ,
:
PROCEDURE P2;
P2
BEGIN.
P1 .....
P1
END;
PROCEDURE P1;
P1
BEGIN .....
P2 .....
P2
END;

96
BEGIN .....
P1 .....
END.

P1

, P1
. .
P1 P2,
FORWARD. :
PROCEDURE P1; forward;
P1
PROCEDURE P2;
P2
BEGIN.
P1 .....
P1
END;
PROCEDURE P1;
P1
BEGIN .....
P2 .....
P2
END;
BEGIN .....
P1 .....
P1
END.

6.7. .
ReadKey KeyPressed
, , .
, :

BEGIN repeat WriteLn( !) until 2>3 END.


, . .
, , . .
, Ctrl, Break,
.
, , .
, ReadKey KeyPressed CRT.
2.2, .
:
USES CRT;
BEGIN
repeat
if KeyPressed then WriteLn( !)
else WriteLn( !)
until 2>3
END.
if KeyPressed then , .
, , . ,
! - ,
!
KeyPressed , - ,
ReadKey , .
, !
, , , w
, ! ,
, q.
USES CRT;
VAR klavisha : Char;
BEGIN
repeat

97
Delay (1000);
{ }
WriteLn( !);
if KeyPressed then
begin
klavisha:= ReadKey;
if klavisha=w then WriteLn( w)
else WriteLn( )
end {if}
until klavisha=q
END.
klavisha:= ReadKey , -
. ReadKey , ,
, - klavisha.
.
!,
w . , ?
, ReadKey ,
.
,
if KeyPressed then? ,
ReadKey , ReadKey
, .
, KeyPressed.
ReadKey ReadLn. :
ReadLn , ReadKey - .
, ReadKey , , ,
, .
ReadKey KeyPressed . .
.
- , .
, .
, ,
.
- typ.
:
WriteLn(, , );
Simvol1:= ReadKey;
Simvol2:= ReadKey;
Simvol3:= ReadKey;
if NOT ((Simvol1=t) AND (Simvol2=y) AND (Simvol3=p)) then Halt;
{ }
: .
. ,
exe (. IV).
96 : : .
.
97 : ().
( ).

6.8.
.
, . .
, , .
, ,
. ,
, , ,
. , , ,
, , . ,
, .

98
,
, , , .
- , . ,
, 16 - 16 ,
. !,
:

99
:

:
!

- :
!

:
!

15- 16- :
!

17- ,
:

. ? . ,
, - ,
ReadLn, ReadKey -. . ,
, ReadKey.
ReadKey :
!

ReadKey

ReadKey:

100
, - , . ReadLn
ReadKey, ,
.
, , .
, .
, , .
,
ReadLn ReadKey .
KeyPressed ReadKey :
KeyPressed , - .
.

ReadKey , .
, ReadKey . ,
( ). ReadKey
.

,
KeyPressed. ReadKey .
ReadLn .
. , (. 2.5). ,
, , , .
, :

while KeyPressed do kl:=ReadKey


, .
:

repeat until KeyPressed


, .
98 : .
, - , - , - .
1.11 , .
99: - , - .

6.9. .
6.2 -,
, :
. ..
, ,
, .
,
. .
.
. ,
.

100: .
. - . ,
, , ,
, - ,
1. , - . 1
. (, 10), .

101
, !,
10, !, 8 . , .
( , ):
USES CRT,Graph;
VAR


PROCEDURE ZAVERSHENIE_IGRI; , , ,
, , . ,
NACHALO, - Halt.
PROCEDURE NE_PORA_LI; .
ZAVERSHENIE_IGRI, RISUNOK.

>10,

PROCEDURE NEPOPAL; ,
NE_PORA_LI.
PROCEDURE POPAL; ,
NE_PORA_LI.
PROCEDURE ATAKA;
.
POPAL NEPOPAL. , .
PROCEDURE KORABL; , ATAKA.
PROCEDURE RISUNOK; , ,
. KORABL.
PROCEDURE NACHALO; ,
, .
NACHALO RISUNOK.
BEGIN
;
DirectVideo:=false;
NACHALO
END.

{ WriteLn }
{ .}

( ). , ,
. ,
, .
Delay , .
, ? ,
, , ,
, .
. , ,
. . , (,
0 10 ), (, 4 8
). .
, , .
.
. ,
,
.

101: . , ,
, , , , ,
( , ). ,
, 98.

102
.
, ,
, , ,
, . -
- III !

103

III.

, , . ,
, . ,
.
. , ,
- ;
, , -
.
,

,
, .
.

104

.0

0.1.
- . , .., .
- ,
. .
:
1)
2)
3)
4)
5)
6)

() :
A, B, C, D,......., Z.
() :
a, b, c, d,......., z.
:
0,1,2,3,4,5,6,7,8,9.

_ .
:
+ - * / = < > ( ) [ ] { } . , : ; ^ @ $ #
,
. , . (2.5),
. , 8 ,
256 . ASCII ( 1.11
). .
:

, , Slovo:=
, ,
{ ASCII: % F

! \ }

0.2.
, ,
. , .
, ( ) (
). Borland Pascal 7.0
DOS TurboPascal 7.0 ( ):
absolute
exports
label
resident
AND
external
library
set
array
far
mod
shl
asm
file
near
shr
assembler
for
nil
string
begin
forward
not
then
case
function
object
to
const
goto
of
type
constructor
if
or
unit
destructor
implementation
packed
until
div
in
private
uses
do
index
procedure
var
downto
inherited
program
virtual
else
inline
public
while
end
interface
record
with
export
interrupt
repeat
xor
,

asm, .

105

0.3.

.
( ).
.
, , .
.

106

.1

1.1.
- : Integer, Char, String
.. , .
, .




Byte
ShortInt
Word
Integer
LongInt

Real
Single
( . )
Double
( . )
Extended
( . )
Comp
( . )

Char

Boolean

()

() ( ):

array

record

set

String


Text

File of

File

Object


Pointer

107
- :
..
,
. .
, , .
: . .
. , , , .
. . .
, .
. . . ,
. .

1.2.

:

Byte
ShortInt
Word
Integer
LongInt


0..255
-128..127
0..65535
-32768..32767
-2147483648..2147483647


1
1
2
2
4

Byte ShortInt, Integer? . , ,


( 0 60),
Byte.

Real
Single
Double
Extended
Comp 9

2.910-39 - 1.71038
1.510-45 - 3.41038
510-324 - 1.710308
3.410-4932 - 1.1104932
-1019 1019

( )
11-12
7-8
15-16
19-20



6
4
8
10
8

Single, Double, Extended Comp


.
, (, 1/3) :
0,3333333333333. , .
1/3, , .
Real 11-12 . ,
.

. , , :
VAR a,b,y : Real;
BEGIN
a:=55555555555.1; b:=55555555555.0;
y:=a-b;
WriteLn (y :30:3)
END.
, 0.100 0.125.

Comp, , , .

108

1.3.
, , .
, .
,
.
1.3.1.

.
:

x1

x2

b8

yi

yi-6 zij

zi+1j

: , , , , , ,
. ,
:

X[1]

X[2]

B[8]

Y[i]

Y[i-6]

Z[i,j]

Z[i+1,j]

?
. , .
.
, , : 1 1 2 3 5 8 13 21 34.....
, . , : ,
, .
.
:
:
f[1],
:
f[2]
..
,
,

f[1]=1

f[2]=1

f[3]=2 f[4]=3 f[5]=5 f[6]=8 ......


f[3]=f[1]+f[2],
f[4]=f[2]+f[3],
f[5]=f[3]+f[4] ..
,
? :
f[i]=f[i-2]+f[i-1].
i , , 6. :
f[6]=f[6-2]+f[6-1]

f[6]=f[4]+f[5].

102: , :
14 18 22 26 .....
6 12 24 48 ....
3 5 9 17 33 65 ....
, .
t[1]
, t[2] - ,....., t[365] - . 35 .
h[1] , , h[2] - ..
1.3.2.

.
, , . - ,
, , ,
.. ,
(. 3.7). , , ,
, .
365 . 365 . , ,
. ,
, (4.1).
, . ,
. (500, 400 600). ,
?
- dlina[1], - dlina[2], - dlina[3].
:
VAR dlina : array [1..3] of Integer
array , 1 - , 3 - .
1 3 (. 1.7) : dlina
Integer, 1 3.
1)
2)
3)

109
:
VAR dlina
:array [1..3] of Integer;
summa :Integer;
BEGIN
dlina[1]:=500;
dlina[2]:=400;
dlina[3]:=600;
{
}
summa:= dlina[1]+dlina[2]+dlina[3];
WriteLn(summa)
END.
,
, dlina[1], dlina[2], dlina[3], summa.
,
ReadLn:
VAR dlina
:array [1..3] of Integer;
summa :Integer;
BEGIN
ReadLn (dlina[1],dlina[2],dlina[3]);
summa:= dlina[1]+dlina[2]+dlina[3];
WriteLn(summa)
END.
, , :
VAR dlina
:array [1..1000] of Integer;
summa, i :Integer;
BEGIN
{ , :}
for i:=1 to 1000 do ReadLn (dlina[i]);
{ i=1 ReadLn(dlina[1]),
i=2 ReadLn(dlina[2]) ..}
{ :}
summa:= 0;
for i:=1 to 1000 do summa:=summa+dlina[i]);
WriteLn(summa)
END.
. 10 : a[1], a[2], ... , a[10].
: a[1]+a[2]+a[3],
a[2]+a[3]+a[4], a[3]+a[4]+a[5], ...... ,
a[8]+a[9]+a[10].
VAR a :array [1..10] of Integer;
i :Integer;
BEGIN
for i:=1 to 10 do ReadLn (a[i]);
for i:=1 to 8 do WriteLn ( a[i]+ a[i+1]+ a[i+2] )
END.

103:. (
).
104:. ( -20 .).
105:. ?
106:. .
1.3.3.

. ,
, .
. .

110

1
2
3

1-
-8
25
11

2-
-14
28
18

3-
-19
26
20

4-
-18
20
25

:
2-


, 24-26

:
t[1,1]
t[1,2] t[1,3] t[1,4]
t[2,1]
t[2,2] t[2,3] t[2,4]
t[3,1]
t[3,2] t[3,3] t[3,4]
, (), -
() .
:
1)
2)
3)
4)

{ 3*4=12 Integer t.
:}
VAR t
:array [1..3, 1..4] of Integer;
s,i,j :Integer;
BEGIN
{ :}
t[1,1]:=-8; t[1,2]:=-14; t[1,3]:=-19; t[1,4]:=-18;
t[2,1]:=25; t[2,2]:= 28; t[2,3]:= 26; t[2,4]:= 20;
t[3,1]:=11; t[3,2]:= 18; t[3,3]:= 20; t[3,4]:= 25;
{ :}
for i:=1 to 3 do WriteLn(t[i,2]);
{ :}
i:=3;
s:=0;
for j:=1 to 4 do s:=s+t[i,j];
WriteLn(s/4 :10:3);
{ :}
for i:=1 to 3 do for j:=1 to 4 do WriteLn (t[i,j]);
{ 24-26 :}
for i:=1 to 3 do for j:=1 to 4 do
if (t[i,j]>=24) AND (t[i,j]<=26) then WriteLn (' ',i,' ',j)
END.

107: .
1.3.4.

, , , ..:
array [1..10] of Integer
-
10
array [1..10, 1..5] of Integer
-
50
array [1..10, 1..5, 1..2] of Integer
-
100
array [1..10, 1..5, 1..2, 1..3] of Integer
-
300
, , .
. :
array [1..50] of Char
, 50 , .
:
array [1..50] of String
50 .
1.13.
, :
array [20..60] of Real
41 .
array [0..9, -10..30] of Real
10*41=410 .
, . ,

111
array [..] of Real
, 1.8.
3.8.

?
. - 3 3.
, () (
) . .
, , .
.
VAR a:
array[1..3,1..3] of Byte
. 0 1
. if (a[1,1]=0)
AND (a[1,2]=0) then a[1,3]:=1. .

1.4.
1 1.3.
VAR s,i:Integer; t:array [1..365] of Integer;
BEGIN
for i:=1 to 365 do ReadLn(t[i]);
s:=0;
for i:=1 to 365 do s:=s+t[i];
WriteLn(s/365)
END.
.
() 365 () 7.

. 6.4 . ,
. ,
.
. ( ), k, CONST
. k:
CONST k =365; { , := = }
VAR
s,i :Integer;
t :array [1..k] of Integer;
BEGIN
for i:=1 to k do ReadLn(t[i]);
s:=0;
for i:=1 to k do s:=s+t[i];
WriteLn(s/k)
END.
.
k=365 k=7.
,
k:=30 ReadLn(k). .
10. :
CONST n
=800;
{ }
e
=2.7;
{ Real}
bukva =;
{ Char}
Slash =/;
{ Char}
slovo =;
{ String}
OK
=true;
{ Boolean}
, .
, , , . , , .
.
10

( )

112

1.5.
CONST , .
- , ,
, , -
. :
CONST n :Integer
=800;
e :Real
=2.7;
1.4, t
:
CONST k =7;
{ k - , }
t :array [1..k] of Integer = (-14, -12, -8, -2, 0, 1, -3);
{ t - }
VAR
s,i :Integer;
BEGIN
s:=0;
for i:=1 to k do s:=s+t[i];
WriteLn(s/k)
END.
t, : t[1] -14, t[2]
-12 .. .
. 1.3
:
CONST k =3; n=4;
t :array [1..k,1..n] of Integer = (( -8,-14,-19,-18),
( 25, 28, 26, 20),
( 11, 18, 20, 25));
.......
.

1.6.
,
- .

TYPE bukva
=
Char
:

bukva "" () Char,


Char "bukva". , :
VAR a,b:Char

VAR a,b:bukva .
:

TYPE Vector
= array[1..10] of Integer;
matritsa
= array[1..8] of Vector;
VAR a,b
:Vector;
c
:matritsa;
d
:array[1.. 8] of Vector;
Vector matritsa. , c
,
TYPE matritsa = array[1.. 8] of Vector

TYPE matritsa = array[1.. 8] of array[1..10] of Integer

TYPE matritsa = array[1..8,1..10] of Integer .

d .

? . . -
- ,
. , , ,

PROCEDURE p(a: array[1..10] of Integer)


,

PROCEDURE p(a: Vector)
.

113

1.7. Boolean
if, while, repeat a>b, i<=0, c=, 3>2,
(a>b)AND(a>c) .. , .
, 3>2 , i<=0 , i , , 2.
.
, 3>2 (- true - ),
i<=0 (- false - ).
-
Boolean. VAR a:Boolean , a - true
false. , a:=false.
true false
. , if a=true then... if (a>b)=false then...
, a b, ....
true false :

while true do .......


repeat ........... until false
.
: - 6 . ?
Boolean. , . Zachet 6 .
CONST Zachet :array[1..6] of Integer = (1,1,0,1,1,1);
VAR
c,i
:Integer;
BEGIN
c:=0;
{c - }
for i:=1 to 6 do if zachet[i] = 1
then c:=c+1;
WriteLn(c)
END.
Boolean. true , false
- .
CONST Zachet :array[1..6] of Boolean = (true,true, false, true, true, true);
VAR
c,i
:Integer;
BEGIN
c:=0;
for i:=1 to 6 do if zachet[i] = true then c:=c+1;
WriteLn(c)
END.
, zachet[i] = true ( )
, zachet[i] = 1 ( , ?). , - .
, if zachet[i] then .... if
, true false.

1.8.
1.7 - ,
. ,
, . ,
. , , :
VAR Month : (january, february, march, april, may, june, july, august, september, october, november, december)
, Month .
, Month:= may. Month ,
.
. , Month:= may. ,
, , ,
Read Write. , .
.

114
: , . ?
.
:
CONST dni:array[1..12] of Byte = (31,28,31,30,31,30,31,31,30,31,30,31);
VAR
s,i :Integer;
BEGIN
s:=0;
{ }
for i:=6 to 8 do s:=s+dni[i]; { - 6,7,8}
WriteLn(s)
END.
- ,
(6 8).
. -, :
TYPE

mes =(january, february, march, april, may, june, july, august, september,
october, november, december);
CONST dni
:array[january..december] of Byte =
(31,28,31,30,31,30,31,31,30,31,30,31);
VAR
s
:Integer;
i
:mes;
BEGIN
s:=0;
for i:=june to august do s:=s+dni[i];
WriteLn(s)
END.
: , for june to
august 6 to 8, dni array[january..december]
array[1..12]. mes,
, i mes, Integer.
:
( , , , . . . . , )

, ,
:

if i = february then dni[i]:= 29

1.9. ()
: 22 10 .
?
:
VAR Otpravlenie, Pribitie :Byte;
BEGIN
Otpravlenie:=22;
Pribitie:=Otpravlenie+10;
WriteLn(Pribitie)
END.
8 32 . ,
Pribitie, 0 24.
, . ,
, .
.
( ).
, :

115
VAR Otpravlenie, Pribitie : 0..24;
BEGIN
Otpravlenie:=22;
Pribitie:=Otpravlenie+10;
WriteLn(Pribitie)
END.
VAR Otpravlenie, Pribitie : 0..24 , Otpravlenie Pribitie
0 24.
,
() Options Compiler Compiler Options Runtime
Errors Range Checking (. IV ).
, :
VAR Month:(january, february, march, april, may, june, july, august, september, october, november, december);
Spring :march..may;
Autumn :september..november;
tsifra
:0..9;
Zaglavnie:..
.
108: (, , , )
. ( , ). 20 .
. .
1: , 1 10 .
2. .
, , 1 .

1.10.
, : ,
Boolean, Char, .
, String.
- , , .
, Byte 256 , 0 255. Integer
65536 - -32768 32767. Char ,
256.
. TYPE weekday =
(mon,tu,we,th,fr) . mon 0, tu - 1, we - 2, th - 3, fr - 4.
VAR a: array[mon..fr] of Real . a[we] ,
a[2], VAR a: array[0..4] of Real .
Char 0 255.
ASCII. , () 129.
(Byte, ShortInt, Word, Integer, LongInt) .
, -58 ShortInt -58.
,
. weekday TYPE days = we .. fr. we 2,
0.

:
1. ORD. (, - )
. :
Ord('')
129
Ord (we)
2
Ord(-58)
-58
2. > < >= <= = <> . ,
'' < '' , we > tu . ,
, .
3. SUCC - successor ( ).
. :
Succ (8)
9

116
Succ('')
''
Succ (we)
th
4. PRED - predecessor -
. :
Pred (25)
24
Pred('')
''
Pred (tu)
mo

successor "". PRED

, , . ,

y:=10+Ord(we)

+Succ(8) y 21.
for , :
for ch := 'd' to 'h' do ...
109: , .
110: , ?
111: . - Nina, Olga, Alex,
Marianna, Ester, Misha, Tolik, Lena, Oleg, Anton, Pankrat, Robocop, Dima, Donatello, Zina, Sveta, Artur, Ramona, Vera,
Igor, Ira. , . :
1) (3 ) ?
2) ?
3) , , ?
: .

1.11. Char.
Char 1.6.
ASCII.
- Chr.
c1:=Chr(69), c1 , 69
ASCII, .. ''.
112: , , Write(Chr(Ord(Succ(Pred('+')))))
113: ASCII, - , 32-255.
:
1) , ;
2) .

.
6.7 .
,

if ReadKey=R then,
- , R.
ASCII, :

if ReadKey=#82 then,
R 82. ,
, . , Tab 9.
, , ,
. , ,
, , . ,
(0,72), Insert (0,82).
. , : R R R Insert Insert:
82

82

82

72

82

82

,
ReadKey . , , Insert,
:

kl:= ReadKey; if kl =#0 then if ReadKey=#82 then


R Insert.

117
, :

Page Up
Insert
Tab
F1
F5
F9

0 72
0 73
0 82
9
0 59
0 63
0 67

Page Down

Delete
Enter
F2
F6
F10

0 80
0 81
0 83
13
0 60
0 64
0 68

Home
BackSpace

F3
F7
F11

0 75
0 71
8
32
0 61
0 65
0 133

End
Esc

F4
F8
F12

0 77
0 79
27
43
0 62
0 66
0 134

1.12. String.
String 0.14.
, ? VAR a:String,
a 255 . b
, , 20 , VAR b:String[20]. b
20 .
.

s1:='';
s2:=''
s5:=''
s3:=''
s3:=''
s5:='';
s6:='';
s7:='';
x:=2.73284
s8='2.73'

k:=Pos('',s5)

s3=''
k=5

l:=Length(s3)

l=10

s4:=Copy(s3,3,4)

s4=

Delete(s5,4,2)

Str(x:4:2,s8)

s5=''
s6=''
s8='2.73'

Val(s8,x,Osh)

x=2.73

+

Pos ,
'' s5
Length ()
()
Copy
4,
Delete s5
,
Insert s6
s7,
Str .
4:2 (. 3.5)
Val .
Osh Integer.

s3:=s1+s2

Insert(s7,s6,3)

Str , , . Graph
(. 4.6). .
,
, . Str. Str Val . 4.6.
s:='', :
s[1]=, s[2]=, s[3]=, s[4]=, s[5]= . s[3]:=
s=''.
. s1=s2 , ,
. . , < ,
, .

114: ,
- , , .
. ,
, .
115: . .
, .
. ,
ASCII. . , , .

118
, ,
. .

1.13.
100 . :
1) , , ;
2), 10 ; ..
, ,
, : , , .
102 :
1) , 2) .
, . 102 ,
101 102 .
VAR nazvanie :array[1..102] of String; { 102 }
skorost :array[1..102] of Real; { 102 }
torped :array[1..102] of Byte;
{ 102 }
i
:Integer;
BEGIN
{ - ,
, - nazvanie[1]:=''.... }
{ :}
for i:=1 to 100 do if skorost[i] > skorost [101] then WriteLn(nazvanie[i])
END.
, :

nazvanie[1]
nazvanie[2]
...........
nazvanie[101]
nazvanie[102]
skorost[1]
skorost[2]
...........
skorost[101]
skorost[102]
torped[1]
torped[2]
...........
torped[101]
torped[102]
i

........

26
24
........
20
18
6
10
........
15
22
?

, .
. , , ,
, :

lodka[1].nazvanie
lodka[1].skorost
lodka[1].torped
lodka[2].nazvanie
lodka[2].skorost
lodka[2].torped
..............
vr .nazvanie
vr .skorost
vr .torped
prot .nazvanie
prot .skorost
prot .torped

26
6

14
10
.........

20
15

18
22

119
.
,
. - () , . , ,
, : - ( String), - 26 ( Real),
- 6 ( Byte). , .
, .
, ,
, , record , , podlodka:
TYPE podlodka =
record
nazvanie
:String;
skorost
:Real;
torped
:Byte;
end;
..........
, . , - ,
. VAR 100
. lodka.
VAR lodka :array[1..100] of podlodka;
vr,prot :podlodka;
{ }
i
:Integer;
..........................
, , ,
, .
:
TYPE

podlodka = record
nazvanie :String;
skorost :Real;
torped :Byte;
end;
VAR lodka
:array[1..100] of podlodka;
vr,prot
:podlodka;
i
:Integer;
BEGIN { . ,
(. )
, :}
lodka[1].nazvanie :='';
lodka[1].skorost
:=26;
........
prot.torped
:=22;
{ :}
for i:=1 to 100 do if lodka[i].skorost > vr.skorost then WriteLn (lodka[i].nazvanie)
END.
, .
,
:
TYPE

podlodka = record
nazvanie
:String;
skorost
:Real;
torped
:Byte;
end;
CONST lodka
: array[1..3] of podlodka
((nazvanie:'';
(nazvanie:'';
(nazvanie:'';
vr
: podlodka
(nazvanie:'';
prot
: podlodka
(nazvanie:'';
VAR
i
: Integer;
BEGIN

=
skorost:26;
skorost:14;
skorost:28;
=
skorost:20;
=
skorost:18;

torped: 6),
torped:10),
torped:11));
torped:15);
torped:22);

120
for i:=1 to 3 do if lodka[i].skorost > vr.skorost then WriteLn(lodka[i].nazvanie);
END.
, record.
116: .
:



. :
1)
2) , .

117:





, 10 . :

1)
2) ,
3) ( ).

1.14.
- ,
, .
. , [7,5,0,4] [ , , ].
, 256 0
255.
, , . ,
[2,5,2] [2,5] .
. [2,5] [5,2] .
set of. ,

VAR a : set of Byte


, ,
Byte. , a
[210, 3, 92], - [8, 5, 3, 26, 17].
VAR c: set of (april, may, june) , c
april, may, june. , [april, june].

VAR d: set of 10..18 , d


10 18.
. : (+),
(*) (-).

[1,2,3,4,5]

,
[1,4,4,5] + [1,2,3,4]

[1,4]

[1,4,4,5] * [1,2,3,4]
,

[2,4]

[1,2,3,4] - [1,3,5]
,

[1,2]*[3,4] [ ], .

121
:
if a = b then ...
a b ...
if a <> b then ...
a b ...
if a <= b then ...
a b, a
if a >= b then ...

b ...
b a, b
a ...

E a:
,

if E in a then ...
a:= [1,2,4]; if 2 in a then ... { 2 a ....}

, , ,
. , , .
:
a, , set of Byte.
, 1 255, , , .
, b:
for i:=1 to 255 do begin
b:=a-[i];
if a<>b then begin WriteLn(i); a:=b end
end {for}
:
for i:=0 to 255 do if i in a then WriteLn(i)
, - . ,
, .
:
, 0 10 ( ).
, . ? ,
.
, , :
CONST razmer = 10; kol = 6;
VAR
Medium, Extrasens :array[1..kol] of 0..razmer;
i, j, k
:Integer;
BEGIN
{ :}
Randomize;
for i:= 1 to kol do begin
Medium[i] :=Random(razmer+1);
Extrasens[i] :=Random(razmer+1)
end {for};
{ :}
k:=0;
{ . k - }
for i:= 1 to kol do
for j:= 1 to kol do
if Medium[i] = Extrasens[j] then begin
k:=k+1;
WriteLn(Medium[i])
{ }
end {if};
if k=0 then WriteLn( )
END.
. 2 4 1 5 4 8 , 1
4 9 6 1 4 . 4 4 1 1 4 4 , 1 4.
, ,
.
:
CONST razmer = 10; kol = 6;
VAR
Medium, Extrasens, a
i

:set of 0..razmer;
:Integer;

122
BEGIN
{ :}
Randomize;
Medium:=[ ]; Extrasens:=[ ];
{ , }
for i:= 1 to kol do begin
Medium
:= Medium + [Random(razmer+1)]; { }
Extrasens := Extrasens+ [Random(razmer+1)] { }
end {for}
a:= Medium * Extrasens;
{ a . .}
if a=[ ] then WriteLn( )
else begin
WriteLn( , : );
{ a:}
for i:=0 to razmer do if i in a then WriteLn(i);
end {else}
END.

118: .
, ,,.

1.15. .

.
. - .
. - .
, . . ""
0, - 1, - - 2 .. 1 ,
, , 1 = 1024 , a 1
= 1024 . : - , - . ,
, .
, ,
. , , " " :
1-1

64

0

. , ,
VAR, CONST .. ( ).
, ( 64). - ,

123
, ( , - .2). , , .

1.16.
:

VAR a: array[1..200, 1..200] of Integer;


, . Integer 2
. 200*200*2 = 80000 . ,
. ( - heap),
.
.
. : y=a+b, a b - 2 3.
:
VAR a, b, y : Integer;
BEGIN
a:=2; b:=3;
y:=a+b;
WriteLn (y)
END.
, 2 5
). :

(, ,

VAR b
: Integer;
a,y
: ^Integer;
BEGIN
New(a); New(y);
a^ := 2; b:=3;
y^ := a^ + b;
WriteLn (y^)
END.
: , BEGIN, : a,y:^Integer
, 2 5, ,
2 5 . , a y - 2 5,
, -, . .
, BEGIN, :
New ( New(a) New(y) ) a y ,
2 5 . ,
- , .
( Dispose,
).
,
.
a^:= 2 , a, 2.
- a^. a:=2, ,
a , , ,
-.
.
. ^, (, ^Integer), ,
( ) (
Integer).
^, (, a^), ,
( a).
( ):
TYPE

D
DP

= array[1..10] of Real;
= ^D;

124

VAR

Int
i, j
m

= ^Integer;
: Int; { i, j - }
: DP; { m - 10 . }

BEGIN
New(i); New(j); New(m);
i^:=4;
j^:=3;
j:=i;
{ j i - 4}
WriteLn(j^);
{ 4}
m^[9]:=300
{ 300}
END.
. MS-DOS
, , , , 64,
:
TYPE
VAR

a
ap
a2
x

=
=
=
:

array[1..200] of Integer;
^a;
array[1..200] of ap;
a2;
{x - 200 ( - 200
)}

BEGIN
for i:=1 to 200 do New(x[i]);
............
x[128]^[35]:=800;
.............
END.

{ }
{ }

, ,
, , ..

125

.2

2.1.
, 4.2: ,
- (-------------).
:
USES CRT;
PROCEDURE doo; BEGIN Sound(523); Delay(2000); NoSound
PROCEDURE re;
BEGIN Sound(587); Delay(2000); NoSound
PROCEDURE mi;
BEGIN Sound(659); Delay(2000); NoSound
PROCEDURE fa;
BEGIN Sound(698); Delay(2000); NoSound
PROCEDURE sol;
BEGIN Sound(784); Delay(2000); NoSound
PROCEDURE la;
BEGIN Sound(880); Delay(2000); NoSound
PROCEDURE si;
BEGIN Sound(988); Delay(2000); NoSound
BEGIN
mi; doo; mi; doo; fa; mi; re; sol; sol; la; si; doo; doo; doo
END.

END;
END;
END;
END;
END;
END;
END;

. , doo
523 200 . ,
, .
.
, 2. ,
587*2=1174 . ,
. , .
, , 2.
- . -,
. ,
House .6,
, . -
. . :
, .
USES CRT;
VAR octava : Byte;
dlit
: Word;
PROCEDURE re;
BEGIN
if octava = 3 then Sound(587) else Sound(1174);
Delay(dlit);
NoSound
END;
BEGIN
octava:=3; dlit:=1000; re;
octava:=4; dlit:=1000; re;
END.

octava:=3; dlit:=2000; re

, .
:
BEGIN
re(3,1000); re(4,1000); re(3,2000)
END.
. ,
:
USES CRT;

126
PROCEDURE re (octava : Byte; dlit: Word); BEGIN
if octava = 3 then Sound(587) else Sound(1174);
Delay(dlit);
NoSound
END;
BEGIN
re(3,1000); re(4,1000); re(3,2000)
END.
: , .

PROCEDURE re (octava : Byte; dlit: Word)


. - re -
. : octava dlit.
, VAR.
re(3,1000) 3 1000 - ,
.
re(4,1000),
octava 4, dlit - 1000 ( ,
) re.
. nota, ,
. , . :
1 - , 1/2 - , 1/4 - .. 1 .
nota : nota(re,5,8) - , ,
re 1/8.
:
USES CRT;
TYPE Nota_type = (doo, doo_diez, re, re_diez, mi, fa, fa_diez, sol, sol_diez, la, la_diez, si);
PROCEDURE Nota(Nazvanie:Nota_type; Oktava,Dolya:Byte); { Dolya - }
VAR Hz:Word;
{ ( Hz).
. - 2.3}
BEGIN
{ }
case Nazvanie of
doo
: Hz:=523;
re
: Hz:=587;
sol
: Hz:=784;
la
: Hz:=880;
la_diez : Hz:=932;
end;
{ }
case Oktava of
1 : Hz:=Hz div 4;
{ , }
2 : Hz:=Hz div 2;
{ Sound }
3 : Hz:=Hz;
{ }
4 : Hz:=Hz*2;
5 : Hz:=Hz*4;
6 : Hz:=Hz*8;
else WriteLn(' '); ReadLn; Halt
end;
Sound (Hz);
{ }
Delay(10000 div Dolya); { p }
NoSound;
Delay (50);
{ }
END;
BEGIN
{ :}
Nota(re,3,8); Nota(re,3,16); Nota(re,4,4); Nota(re,4,8); Nota(re,4,8); Nota(doo,4,8);
Nota(la_diez,3,8); Nota(la,3,8); Nota(sol,3,4); Nota(re,3,4)

127
END.
. ,

Nota(re,3,8) a:=3; Nota(re, a, 11-a).


119: Graph , .
. :
.

2.2.
0.9 . ,

10+Sqr(3)

19, Sqr(3) 3 .
. ,
. perimetr(10,4),
10 4. , ,
:
FUNCTION perimetr(dlina,shirina:Word) : Integer;
BEGIN perimetr:=2*(dlina+shirina) END;
BEGIN
WriteLn(perimetr(10,4)+ perimetr(20,30)+ perimetr(3,8));
END.
.

:
(
Integer).
BEGIN END -
( perimetr:=2*(dlina+shirina)).
. 1.3 ,
365 . , ( 1-31)
( 335-365) . ,
, -.
,
. max. , , , : u:=max(20,30),
, u
, 20- 30-. :
VAR t : array [1..365] of Integer;
{ t - }
FUNCTION max (perv,posledn:Word) :Integer;
VAR i,m :Integer;
BEGIN
m:=t[perv];
for i:=perv+1 to posledn do if t[i]>m then m:=t[i];
max:=m
END;
BEGIN
........ { }
if max(1,31)>max(335,365) then WriteLn( ) else WriteLn( );
END.

120: .
3
Power : Power(2,3) 2 , 8.
121: ,
(, x y), ,
y , . ,
, , Circle (x(310), y(230), 10) .

128

2.3. .
, .

. ,
, - . , ,
. ,
, .
, .
.
"" , - :
1) 5 ,
2) , - 10 "

",

3) , :
VAR x,y : Integer;
PROCEDURE B; BEGIN y:=10*10; Write(' ') END;
BEGIN
x:=5;
B;
WriteLn(x);
END.
, 5.
, , -
. , ,
,
. -
.
, .
, -
, ,
. , ,
10*10 . :
VAR x,y : Integer;
PROCEDURE B; BEGIN x:=10*10; Write(' ') END;
BEGIN
x:=5;
B;
WriteLn(x);
END.
,

100.

,
.
.
. - , ,
. , 10*10 , , ,
, ,
:
VAR x : Integer;
PROCEDURE B;
VAR x : Integer;
BEGIN x:=10*10; Write(' ') END;
BEGIN
x:=5;
B;
WriteLn(x);
END.

129
5. : ,
, ,
. , , , ,
, . .
, x x.
, , . .
, , .
, , .
.
x, ,
x, .
:
VAR x,z : Integer;
PROCEDURE B;
VAR x,y : Integer;
BEGIN
x:=20; y:=30; z:=40
END;
BEGIN
x:=1; z:=2;
B;
WriteLn(x,' ',z)
END.
1 40. : WriteLn(x,z) ,
=20, , .
=1, . z , ,
z:=40 2 40.
:
1) Z .

= 1 Z = 2.
3) .
2)
.
4) = 20, = 30

Z = 40.
5) . = 20 = 30.
6) = 1 Z = 40.
.
.
. , . (
-, ).

2.4.
, ,
, , . .
: , . .
sum, .
:
TYPE
vector
= array [1..2] of Integer;
VAR
a,b
: vector;
FUNCTION sum (c:vector):Integer;
BEGIN sum:=c[1]+c[2] END;
BEGIN
a[1]:=10; a[2]:=20;
b[1]:=40; b[2]:=50;
WriteLn (sum(a),' ',sum(b));
END.

130
sum(a), c
a. sum(b),
c b.

function sum (c: array [1..2] of Integer):Integer.


TYPE,
a b, . .
122. . - 5 .
. , ( , ,
).
: min(c:vector), max(c:vector) raznitsa(c:vector).

2.5. - -
, , , - .
, B x
y.
VAR x: Integer;
PROCEDURE B (y:Integer);
BEGIN x:=x+y END;
BEGIN
x:=1000;
B(1);
WriteLn(x)
END.
1001.
,
. - , ? -.
:
VAR x: Integer;
PROCEDURE B (y:Integer; var c:Integer);
BEGIN c:=c+y END;
BEGIN
x:=1000;
B(1, x);
WriteLn(x)
END.
y - . -.
-
(1).
c - -, - var.
- ,
.
, ( x). , var
.
: B(1, 1000)? : , ,
1001. , .

123: (A B) .
365. , A
2 , B - 3 . ,
. - , - - .

131

2.6. . .
. N
1 N. , 1*2*3*4*5, 120.
1.
. , , , .
:
1. N, ,
N, N-1.
, - . .
, - N, , 100.
: 100 100, 99.
? , - , ,
? :
:
3 . ,
. .
:
2 . ,
. .
:
1. - .
.
.
2 1, 2.
.
3 2, 6.
.
, .
, .
? ,
, - . ,
.
N, Factorial(N),
:
N=1, Factorial(N) = 1.
N>1, Factorial(N) N Factorial(N-1).

Factorial :

FUNCTION Factorial(N: Byte): LongInt;


BEGIN
if N=1 then Factorial :=1;
if N>1 then Factorial :=N* Factorial(N-1)
END;
BEGIN
WriteLn(Factorial(3))
END.
, . ,
Factorial - Factorial(N-1).
?
.
,
WriteLn(Factorial(3)).

132

Factorial. ,

,
N. 3
N, N
3. . 3>1,
3* Factorial(3-1)

Factorial(2), ,
, Factorial(3),
, .
.
N. N, . N
2. .
, ,
. 2>1,
2* Factorial(2-1)
Factorial(1),
.
.
N. N 1.
. 1=1,
Factorial :=1. - .
if N>1 then Factorial
:=N* Factorial(N-1). , 1>1,
. .
.
(, N=2) Factorial :=2*1=2.
.
(, N=3) Factorial :=3*2=6. .
.
, .
. 64K.
.
, . , ,
, , .
?
, , .
: - .
?
, ,
.

124: fib .

2.7.
: 8 2 5 4. (2 4
5 8) (8 5 4 2). ( ASCII) (
).

133
- , -
.
: 100 . .
, ,
, . 100 ?
100 .
, , (
0).
. .
10 :
CONST
TYPE
CONST
VAR

N
= 10;
vector
= array[1..N] of Word;
massiv_ishodn
: vector =(3,8,4,7,20,2,30,5,6,9); { }
massiv_rezult
: vector;
{ }
i
: Word;
FUNCTION maximum (m:vector; N:Word; var Nomer_max: Word):Word; {
}
VAR i,max:Word;
BEGIN
max:=m[1]; Nomer_max:=1;
{ }
for i:=2 to N do if max<m[i] then begin max:=m[i]; Nomer_max:=i end;
maximum:=max
END;
PROCEDURE sortirovka (mass_ish:vector; N:Word; var mass_rez:vector);
{ }
VAR i, Nom_max:Word;
BEGIN
for i:=1 to N do begin
mass_rez[N+1-i]:=maximum(mass_ish, N, Nom_max);
mass_ish[Nom_max]:=0
end{for};
END;
BEGIN
sortirovka (massiv_ishodn, N, massiv_rezult);
for i:=1 to N do Write (massiv_rezult[i],' ');
{ }
END.
maximum, , ,
- Nomer_max. .
. - . ,
, 100
100*100=10000 .
. - .
. . .
. .
.
, , ,
.
: , , ,
, . .
. , , ,
.
. , , , .
, , 100 ,
99 . .
, .
:
CONST N
= 10;
TYPE
vector
= array[1..N] of Word;
CONST massiv : vector =(3,8,4,7,20,2,30,5,6,9);
VAR
i
: Word;
PROCEDURE puziryok (var mass:vector; Razmer:Word);
VAR i,m,c:Word;

134
BEGIN
for m:=Razmer downto 2 do begin
for i:=1 to m-1 do begin
if mass[i]>mass[i+1] then begin
c:=mass[i];
mass[i]:= mass[i+1];
mass[i+1]:=c
end{if}
end{for};
end{for};
END;
BEGIN
puziryok (massiv,N);
for i:=1 to N do Write (massiv[i],' ');
END.

{ 9}
{i }
{ }
{ }
{ c}

{ }

125: . :
a[1,1] >= a[1,2] >= >= a[1,N] >=
>= a[2,1] >= a[2,2] >= >= a[2,N] >=
>= a[3,1] >= a[3,2] >=

135

.3
,
.
,
.

3.1.
:

BEGIN

END.

, , . - , ,
, BEGIN END. :

BEGIN

WriteLn(1993);

WriteLn(1994)

END.

, , .
BEGIN. :
CONST k = 10;
VAR
a : Real;
BEGIN
a:=5;
WriteLn(a+k)
END.
, :
1) BEGIN ,
2) BEGIN .
, .

, :

VAR

LABEL

CONST

PROCEDURE

FUNCTION

, ,

TYPE
,
USES.
, , PROGRAM
.
:
PROGRAM
USES
LABEL
CONST

Divan;
Crt,Graph;
met1,met2;
k
= 100;
S
= '!';
TYPE
Kniga
= array [1..k] of String;
Tablitsa = array [0..20,1..10] of Integer;
Minuta = 0..60;
VAR
x,y
: Real;
Uspevaemost : Tablitsa;
PROCEDURE Torpeda......
FUNCTION Invers......
BEGIN
.......

136
END.

3.2.
,
, , .
, .
. ,
.
, ,
. , ,
. , ,
, .
,
.

.
, , , , .
, .
,
USES.
:
PROGRAM Hard;
USES ...
LABEL ...
CONST ...
TYPE ...
VAR
...
PROCEDURE a1;
CONST ...
VAR
...
PROCEDURE a11;
LABEL ...
TYPE ...
VAR
...
BEGIN
...
END;
FUNCTION f11
VAR
...
BEGIN
...
END;
BEGIN
...
END;
FUNCTION f2;
PROCEDURE a21;
BEGIN
...
END;
BEGIN
...
END;
BEGIN
...
END.
Hard a1
f11. f2 a21.

f2. a1 a11

137
f2 a1, a11 f11. a21 a1 f2, a11 f11.
, a21 a1 f2, a11 f11.

3.3.
. ,
. :
a := b+1
b+1
if c-6>f then
c-6>f
WriteLn (a+5)
a+5
, ,
.
( ):
0
2+5
Sqrt(b+1) - Sqr(a[4,i]+r) + 1
a[4,i] + vovka.ves
((w+b)/19)*(2/(w+1)+5)

( ):

Copy(s,a,b)
Copy(s,a,b)+

( true false):

a>0
(a+c)/(d+8)<=b+1
c>
stroka=
Copy(s,a,b)+ <> s1
a in b

, ,
(, ) .
, , , ,
, .
.
.
.

3.4.
Type mismatch ( )
. , ,
VAR y: Integer BEGIN y:=3/8: ., ,
y , Integer. , , .
. ,
? ? , a+b
:

VAR a: Byte; b: Word;


BEGIN .... a+b ... ?
- ,
. :
,
. a Word
.

138

, , .

VAR a: Integer; b: Word;


BEGIN .... a+b ...
a b LongInt.

, , - .
(, a+b*c)
, ( b*c
, ).
. ,
( 1) ( 2)
:

, , 1 2, :

(sun, mon, tue, wen)


String
1 - ,

2
(sun, mon, tue)
Char
2

.
, - . .
, 1 , 2 .

3.5.
() , ,
WriteLn , ,
. ,

c:=''; s:=''; i:=18;

WriteLn(c,s,i)


1 8

, :

WriteLn(c:3,s:8,i:4)
:

1 8

c ( 1 3), . s 8
( 4 11). i 4 ( 12 15). ,
.
: Real
. ,

r:=465.28073; WriteLn(r)

4 . 6 5 2 8 0 7 3 0 0 0 0 2 3 1 E + 0 0 0 2

4.65280730000231 * 10 2 , , 465.280730000231. -
231. .
:
r:=0.000000308; WriteLn(r)
3 . 0 8 0 0 0 0 0 0 0 0 0 0 7 9 E - 0 0 0 7

3.08000000000079 * 10-7 , , 0.000000308000000000079 .


:
r:= -0.000003; WriteLn(r)
- 2 . 9 9 9 9 9 9 9 9 9 9 9 9 5 3 E - 0 0 0 6

-2.99999999999953 * 10 -6 , , -0.00000299999999999953,
-0.000003.
? :9:3 Real
, 9 , 3 .
:

r:=465.28073; WriteLn(r:9:3)
4 6 5 . 2 8 1

, , .
:
r:=465.28073; WriteLn(r:10:0)

139
4 6 5

r:= -465.28073; WriteLn(r:10)

- 4 . 7 E + 0 0 0 2

"" .

3.6.

VAR i:Byte;
BEGIN i:=250; WriteLn(i); i:=i+10; WriteLn(i) END.
250 4. 250 260? Byte 0
255. ,
, . . ,
(. ).

3.7.
. ,

VAR a : array[1..10] of array [2..5] of set of Byte , , a


array[1..10], array [2..5],
, set, Byte.
, , , . ,
, .
.

Array *

String

Record

**

Set

Char
Boolean

*)

**)

140

3.8.
,
. , , ,
, .
. 1.2,
.
- ( ).
. , - ,
, . .
:
__

__

. .
, , . ,
. , , , N. .
, , .
, , . , , .
, , 8. N8. . ,
. .
. -
, -
, , .
.
, , .

BEGIN
BEGIN

END.
END.

141

PROGRAM
PROGRAM

;;

USES
USES

;;

,,




;;

goto
if

::

case
repeat
while
for


with
;;


: LABEL
1; BEGIN ; ; 1: ; ; END.
with
.

(record).

142

==

::

CONST
CONST

==
;;

: . 12.5

TYPE
TYPE

==

;;

*)

Real
Single Double Extended
Comp.

.

^^

Pointer
Pointer

Char
Char

Boolean
Boolean

((

....

,,

))

Integer
LongInt
Word
Byte

ShortInt.

143

[[

array
array

,,

record

,,
record
record

of
of

]]

::

.


,
,

end
end

;;

set
setof
of

[[

]]

string
string

LABEL
LABEL


,,

,,

VAR
VAR


;;

::

144

PROCEDURE
PROCEDURE

FUNCTION
FUNCTION

::

;;

;;

BEGIN
BEGIN

BEGIN
BEGIN

END
END

END
END

. 6.6

,,

VAR
VAR

((

::
;;

..

:=
:=


[[

,,
^^

]]

))

145

))

,,

goto

goto
goto

if

case
case

((

ifif

then
then

of
of

else
else

case

;;

....

::

,,
;;
else
else

;;
end
end

;;

repeat

repeat
repeat

until
until

146

while

for
for

while
while

:=
:=

for

to
to

do
do

do
do

downto
downto

;;
begin
begin

end
end

. 14.3.
,
. ,
,
. , if
, for - .


(, const
k=-2; l=).
,
,

,

(,
const
k=-5;
m=(1+k)*abs(k))

,
.

, ,
, .

147

.4

.
.

4.1.
, - .
.
, . ,
, - , ,
.
. -
. , ,
. , - ,
, , -
. , , .
:
PASCAL.

1998 c: fedos,

, fedos , .
fepas. , fepas - ,

VAR fepas :Text;
, ,
fepas:
Assign(fepas, 'c:\PASCAL\fedos');
(
):
Rewrite(fepas);
:
WriteLn(fepas, );
WriteLn(fepas, 1998);
, :
Close(fepas);
:
VAR fepas :Text;
BEGIN
Assign(fepas, 'c:\PASCAL\fedos');
Rewrite(fepas);
WriteLn(fepas, );
WriteLn(fepas, 1998);
Close(fepas);
END.
fedos :

1998
WriteLn Write, :

1998
fedos , Rewrite
. , .

148
, - ,
Rewrite . Append. Append(fepas).
, , ,
fedos ,

Assign(fepas, 'fedos')
, .
- , , . ,
.
: fedos .
.
VAR fepas :Text;
a,b,c :String;

{ ,
}

BEGIN
Assign(fepas, 'c:\PASCAL\fedos');
Reset(fepas);
{
( ) }
ReadLn (fepas, a); { }
ReadLn (fepas, b);
{ }
ReadLn (fepas, c);
{ }
Close(fepas);
WriteLn(a);
{ }
WriteLn(c);
{ }
END.
, , , .
, c, , .
, 10 ,
.
VAR f
:Text;
a,b :String;
i
:Byte;
BEGIN
Assign(f,'c:\PASCAL\textik.txt');
{ textik.txt PASCAL f}
Rewrite(f);
{
( )}
WriteLn(' 10 ');
for i:=1 to 10 do begin
ReadLn(a);
{ }
WriteLn(f,a)
{ }
end;
Close(f);
{ }
WriteLn(' , :');
Reset(f);
{
( )}
for i:=1 to 10 do begin
ReadLn(f,b);
{ }
WriteLn(b)
{ . }
end;
Close(f);
{ }
END.
, , , - ,
, . - EOF ( end of file
). , :

while NOT EOF(fepas)


do
... ReadLn(fepas, ....)
fepas
126: . ,
. , , ,
. 4 :

149
1) .
2) .
3) . ( ,
1000 .)
4) , - (, ).
, , -
, : - ,
...? .
127: 1.13
.
128: ,
, ,
, , , .
S , , ,
. ,
.

4.2.

, . ,
7 . 3 , - 4
. 4 VSTAVKA.pas . :
PROCEDURE fa ; BEGIN Sound(698); Delay(300); NoSound
PROCEDURE sol; BEGIN Sound(784); Delay(300); NoSound
PROCEDURE la ; BEGIN Sound(880); Delay(300); NoSound
PROCEDURE si ; BEGIN Sound(988); Delay(300); NoSound

END;
END;
END;
END;

, .
:
USES CRT;
PROCEDURE doo; BEGIN Sound(523); Delay(300); NoSound END;
PROCEDURE re ;
BEGIN Sound(587); Delay(300); NoSound END;
PROCEDURE mi ;
BEGIN Sound(659); Delay(300); NoSound END;
BEGIN
doo;re;mi;fa;sol;la;si;la;sol;fa;mi;re;doo
END.
.
( , IV). , ,
, , $I.
- ,
.
{$....} - .
, , .
{$I c:\PASC\F25} , F25
PASC c. , .
:
USES CRT;
PROCEDURE doo;
PROCEDURE re ;
PROCEDURE mi ;

BEGIN Sound(523); Delay(300); NoSound END;


BEGIN Sound(587); Delay(300); NoSound END;
BEGIN Sound(659); Delay(300); NoSound END;

{$I VSTAVKA} { VSTAVKA}


BEGIN
doo;re;mi;fa;sol;la;si;la;sol;fa;mi;re;doo
END.

150

4.3.
, , .
, . , , ,
. :
FUNCTION st(a:Real; n:Word) :Real;
VAR step :Real;
i
:Word;
BEGIN
step:=1;
for i:=1 to n do step:=step*a;
st:=step
END;
BEGIN
WriteLn(st(2,3))
{ 2 , 8}
END.
, .
st. :
st $I.
st ,
.
, . :
UNIT Mathemat;

{ }

INTERFACE
{ }
FUNCTION st(a:Real; n:Word) :Real;
IMPLEMENTATION { }
FUNCTION st;
VAR step :Real;
i
:Word;
BEGIN
step:=1;
for i:=1 to n do step:=step*a;
st:=step
END;
BEGIN
END.

{ , }

, ,
Mathemat.pas, , ,
. ,
. , .
, :
USES Mathemat;
BEGIN
WriteLn(st(10,6) :20:4);
WriteLn(st(5, 3) :20:4);
END.

{ 10 }
{ 5 }

- , .
, ,
, ,
. , , .
,
, .
, , ,
.
, ,
Mathemat.tpu.
, Mathemat.pas ( , ).

151
. ,
. , Graph
, . ,
, .
, :
UNIT Mygraph;
INTERFACE
{ }
PROCEDURE krest(x_tsentr, y_tsentr, razmer:Word);
{ }
PROCEDURE treug(x1, y1, x2, y2, x3, y3 :Word);
{ }
IMPLEMENTATION
{ }
USES Graph;
{ Line}
PROCEDURE krest; BEGIN
Line(x_tsentr-razmer, y_tsentr, x_tsentr+razmer, y_tsentr);
Line(x_tsentr, y_tsentr-razmer, x_tsentr, y_tsentr+razmer);
END;
PROCEDURE treug; BEGIN
Line(x1,y1,x2,y2);
Line(x2,y2,x3,y3);
Line(x3,y3,x1,y1);
END;
{ }
VAR d,m :Integer;
{ }
BEGIN
d:=0;
InitGraph(d,m,'< .>');{ }
SetColor(Yellow);
{ }
SetLineStyle(0,0,ThickWidth);
Rectangle(10,10,630,470);
SetColor(White);
{ }
SetLineStyle(0,0,NormWidth) { }
END.
, , ,
- ,
. , ,
.
, , :
USES Mygraph,Graph;
BEGIN
treug(500,50,600,300,450,450);
krest(200,150,80);
Circle(100,350,40);
ReadLn;
END.
Graph - .

$I :
.
64.
64.

129: , Music, Graphica - .

4.4. Graph
, - , Graph ,
. :

152

GetMaxX :Integer
GetMaxY :Integer
GetPixel(x,y :Integer) :Word





x y.

Arc (x,y :Integer; fi1,fi2,r :Word)

PieSlice (x,y :Integer; fi1,fi2,r


:Word)
FillEllipse (x,y :Integer; rx,ry
:Word)
Sector (x,y :Integer;
fi1,fi2,rx,ry :Word)

Bar (x1,y1, x2,y2:Integer)


Bar3D (x1,y1, x2,y2:Integer;
tol:Word; top:Boolean)

x,y
r. fi1
fi2 .
.
, Arc.
SetFillStyle.
x,y
rx,ry.
SetFillStyle.
.
x,y rx,ry.
fi1 fi2
.

(x1,y1) (x2,y2)
,

(x1,y1) (x2,y2).
tol. top TopOff,
, top TopOn, .

4.5.
: , , .
- , , 5.3,
. - , ,
GetImage PutImage,
.
1. ,
.
USES
VAR

Graph;
Gd, Gm : Integer;
P
: pointer;
Size
: Word;

BEGIN
Gd := 0; InitGraph(Gd, Gm, ':\tp\bgi');
SetLineStyle(0,0,Thickwidth);
{ :}
Circle(50,100,20); Circle(50,100,15);
Circle(90,100,20); Circle(90,100,15);
{ :}
Line(0,0,640,480);
Size := ImageSize(10,60,120,140);
GetMem(P, Size);
GetImage(10,60,120,140,P^);
ReadLn;
PutImage(500,400, P^,0);

153
ReadLn;
CloseGraph
END.
: ,
. , , .
(10,60) (120,140). ,
, .
ImageSize. ,
. GetMem. - GetMem(P, Size). P
, . .
, , .
GetImage, P^ . PutImage
(500,400).
, , GetImage
, PutImage , GetImage,
, . PutImage,
. , , .
130: .
2. .
USES
VAR

Graph,CRT;
x,Gd, Gm : Integer;
P
: pointer;
Size
: Word;

BEGIN
Gd := 0; InitGraph(Gd, Gm, ':\tp\bgi');
SetLineStyle(0,0,Thickwidth);
{ :}
Circle(50,100,20); Circle(50,100,15);
Circle(90,100,20); Circle(90,100,15);
{ :}
Line(0,0,640,480);
Size := ImageSize(10,60,120,140);
GetMem(P, Size);
GetImage(10,60,120,140,P^);
{ :}
x:=20;
while x<300 do begin
PutImage(x, 150, P^,1);
Delay(40);
PutImage(x, 150, P^,1);
x:=x+1;
end{while};
CloseGraph
END.
: - , ,
PutImage(x, 150, P^,1). , ,
, . - 1.
, , , , .
131: .

4.6.
WriteLn . Graph

SetTextStyle OutTextXY, (
) , SetTextStyle ,

154
OutTextXY . ,

SetTextStyle (4,0,8);
OutTextXY(200,300,Hello!)
Hello!, 4 () 8.
(200,300). 0 , 1
, 2 - . , ,
SetColor.
5 :
0 - ( - )
1 -
2 -
3 -
4
. .
SetUserCharSize. , SetUserCharSize(7,3, 9,4) 7/3
, - 9/4.
, .
-, - .
OutTextXY - . ,
. a , Integer, 937.
OutTextXY(200,200, a) . as , String.
:
a:=937;
Str(a,as);
OutTextXY(200,200, as)
Str a=937 as=937.
Val:
VAR a,err :Integer;
as
:String;
BEGIN
as:='937';
Val(as,a,err);
WriteLn (a+1);
ReadLn
END.
: Val 937 937.
WriteLn (a+1) 938. err .
132: .
. , :
, , .

4.7. ( CRT)
, . ,
.
CRT. :
TextColor (Yellow)

TextBackground (Blue)
.
, ,

ClrScr
.
TextBackground (Blue),
ClrScr
GotoXY(61,14)
61 14

155
.
GotoXY ,
. , 25 80 .
, - . 61 14 ,
GotoXY(61,14).
:
.
:
USES CRT;
BEGIN
TextBackground (Red);
ClrScr;
TextColor (Yellow);
TextBackground (Blue);
GotoXY(38,13);
WriteLn()
END.

4.8. ( DOS)
. ,
, .
DOS. ,
:
GetTime

SetTime

GetDate

SetDate

, ,
:
God
( 1980 2099)
Mes
(1-12)
Den

Den_Ned
( 0 () 6 ())
Chas

Min

Sec

Sotki

, Integer, ,
Word. . Word
0 - 65535.
, , :
USES DOS;
VAR God, Mes, Den, Den_Ned, Chas, Min, Sec, Sotki : Word;
BEGIN
GetDate(God, Mes, Den, Den_Ned);
WriteLn(
, Den, . ,Mes, ,God, );
GetTime(Chas,Min,Sec,Sotki);
WriteLn(
, Chas,' . ' ,Min, ' . ' ,Sec, ' .')
END.

133 : :
( 2 - 4) . , . ,
.
, GetTime .
, DOS. , ,

156

.

for i:=1 to 10000000 do;

:
SetDate(1997, 5, 22)
- 22 1997
SetTime(23, 58, 32, 93)
- 23 58 32 93
, ,
. , , , .

134 : .
, ..
, , ,
, , .

4.9.
. , ,
. 2/3 , ,
. -
,
.
. , .

Graph. ,
(). ,
. , 16 .
. ,
. ,
.
, .
.
CRT. Graph, , CRT
, 80 40,
, .
Overlay.
, ,
. Overlay ,
. ,
, , ,
, , , .
. : .
, (,
Integer ). , ,
,
.
:
,



DOS
MS-DOS, :



()
DOS

157

. 4.2 {$I.},
.
, ,
.
{$.}, .
. ,
.
, ,
. .
.
.
.
.
, .
. ,
. , (record),
. :
TYPE X1 =
OBJECT
A
:Integer;
B
:String;
Procedure C(f:Char);
Function D:Word
END
. ,
, (, ,
) ( ,
).
Windows.
, , , ,
() , ( ).

.
Assembler, . ,
(, ).
. ,
.
,
, .
,
, .

4.10.
. . , ,
.
,
, , ..
,
, Delphi, , -
, , ,
, , .. ,
, , .
, .

. :

135 - II

158
-

.
. - ,
- 3 3, , 3, 5
. , ,
20 20 10 10.

, -
.


. , ,
, (,
)
F1 .

, , :
, , , .
, -, . ,
,
, . , .
:
, . -
. ,
: -
. , . ,
. ,
.

. ,
,
, , , ! .
, , ,
,
. , ,
-.
!

159

IV.

. ,
, .

. ,
. , - ,
, , . ,
, ( ,
Windows Norton - ,
).
. ,
1, .
, , ,
. , () . ,
2, .
( , 2).


(1)
(2)
(3)
(4)





, 6
(5)
3
(6)
.

(1)
, . , , ,
. , 50 50.

160
2 (2) (3) ,
(, , (..)). ,
. , ,
TP TP70 PASCAL - ( Borland Pascal, ,
, BP). . ,
- , , PROGRAMS. WINDOWS,
, . .
turbo.exe ( Borland Pascal, bp.exe). ,
BIN.
:
, .
, , () ,
, . .
. :
) , Norton Commander.
.
) Windows 95.
) Windows 3.1 3.11.
.
) Norton Commander. ,
. - -
. ,
. . ,
. ,
.
F2. , . ,
Esc .
, , , , Tab, Enter ,
(3) .
, , , , Enter.
, , Alt,
F1 F2 .
. . .
, Enter. .
) Windows 95. Turbo Pascal ,
, . , ,
Enter. .
,
. . , .
, ,
(3) . .
, , 2. ,
+, .
-. .
.
, .
.
, , ,
-. Norton Commander.
, , . nc.exe,
, , , NC NC50 Norton . ).
) Windows 3.1 3.11. .
, . , .
, , . .
. .
. (,
c:\tp\turbo.exe) . , . , Windows
, . ,

161
. ( ).
, .
. , , .
, .
- , - .
. , . .
.

(2) . .
, , , .
. , . ,
, .

,
- . , . -
. .

162

- File ,
- New.
, F10, File
. New .
. , ,
. , 1,
.
( , . File New).
- File Exit.

(3) .

, , .
. , ,
.
. ,
. ,
() .
File Save. ,
, , ,
( , ,
).

, , ,
, ( ..), .
. , Windows,

163
- (BackSlash)
.
, .
. . .
, , .
OK. .
NONAME00.PAS PAS.
.

: File Save. . , ,
,
( , , , ). .
- ,
File Save as ,
. OK.
, .

. , ,
. , , .
: File Open. , ,
:

: ,
. ,
, Open. .

(4)
, , ,
, . ,
( ), .
Run. Run.
. , . ,
, .
,
, . ,
, , .
, , , -
, - , .
, :
, , User Screen. - 7.0
Debug. , Alt-F5.
. :
, .
ReadLn. ,
ReadLn, ,
, , .
, .

164

. ,
. ,
( !). ,
.
( ReadLn ).
, , ReadLn,
.
. , , , . ,
, .
,
, , .
( ) CtrlBreak. . , ,
. , .
, Ctrl-F2.

(5) . .
. , , ,
. , ,
BIGIN BEGIN. .
, Sqrt(-25), -25. , , a ,
a*a*a a*a, .
,
, , , .
,
Runtime error
, , , .
:

Unexpected end
of file

END.
begin end
; expected

, expected


) expected
)

Unknown identifier

, , ReedLn

ReadLn
Type mismatch

:
VAR c:String; c:=1+2 VAR h:Integer; h:=9/7
Duplicate identifier
. , VAR a, c, a :String;
Syntax error

. ,


BEGIN expected BEGIN
, begin end
END expected
END
, begin end
String
constant
exeeds line

165
Line too long

Disk full
Lower bound
greater than upper
bound
Invalid floating
point operation

Ordinal
expression
expected
Error in

expression
Range check error

Constant out of

range

Invalid numeric

format

(
, ).

. -
, array[2..5] array[5..2].

Sqrt(-25) a/0 -

for i:=1 to 8 for i:=1 to 8.5

k:=*8 k:=**8


, , 1.9

, , ReadLn(k) VAR
k:Integer; . ReadLn(k) 25.3

0.3.

:
expected

identifier

invalid

operation

error

variable

, .
, .
, .


, , .
, , . . .
.
.
.
. .
.
1.1: -
. - . a1 , a2 - , V - . :
VAR a1,a2,V : Real;
BEGIN
ReadLn (a1,a2);
if a1>a2
then V:=a1*a1*a1
else V:=a2*a2*a2;
WriteLn (V : 15:5)
END.
, , F7,
RunTrace into. (, ,
, .)
, BEGIN.
F7. , .
ReadLn (a1,a2).

166
, F7
, .
F7. ReadLn (a1,a2), ,
, . .
, , 5 4, . ,
, if a1>a2.
F7. if a1>a2, then V:=a1*a1*a1, 5>4.
F7. else V:=a2*a2*a2 WriteLn (V : 15:5).
F7. WriteLn (V
: 15:5), ,
END.
F7. . . Alt-F5.
.
, 2 3. if a1>a2

ReadLn (a1,a2)
then V:=a1*a1*a1, else

V:=a2*a2*a2.
F7 RunRun (
Ctrl-F9) . ,
Run Program reset ( Ctrl-F2).


, 2.1 - ,
:
LABEL m1,met5;
VAR
n,k : Integer;
BEGIN
n:=10;
k:=0;
WriteLn(' ' );
met5:Write(n);
n:=n+k;
goto m1;
n:=n+1;
m1: Write(' ');
ReadLn;
k:=k+1;
goto met5;
WriteLn(' ')
END.
: :

10
10
11
13
16
20

. , - . ? ,
. , . ? , ,
n k.
. ,
.
. ( ,
. , .)
, . DebugOutput. ,
, . .
- DebugWatch. ,
. .

167
(
, ):

168

, . ,

n k. : DebugAdd watch , n
OK. n:7 n:0 - .
. k.
. F7.
, ,
, BEGIN.
F7. , , .
. n:=10.
, F7
, .
F7. n:=10, n 10,
k:=0.
F7. k:=0, k 0,
WriteLn(' ' ).
F7. WriteLn(' ' ),
, met5: Write(n).
F7. Write(n). 10,
n 10 ( ). n:=n+k.
F7. n:=n+k, n 10,
k 0. goto m1.
F7. goto m1. m1: Write(' ').
F7. Write(' ' ) , 10
, ReadLn.
F7. ReadLn,
ReadLn , . k:=k+1.
F7. k:=k+1, k 11.
goto met5.

169
F7.

goto met5. , met5: Write(n).

.
- , , ,
.
,
, . , .
, F7, F8.

. F7 F8. F7
, F8 - .


- Breakpoints. ,
. ,
F7.
, - , .
Ctrl-F8. . ,
.
.
Ctrl-F8. .
.
.
(Run Run Ctrl-F9) .
, - .
, , Ctrl-F9. .
, - Ctrl-F8.
- Goto cursor. .
F4. , .
F4. ,
, , . .
,
F7, F4 Ctrl-F9.
Write ReadLn. ,
. .
. ,
n k,
Write( n=,n, k=,k).
ReadLn. , .
, ,
Write, , .
, , , ReadLn
( ) .
GotoXY (.4.7).
CRT (. 5.1) DirectVideo:=false (.6.3).

.
, , FileNew. FileNew .
. ,
. F6.

170
FileNew,
FileOpen,
.
, , .
, , , .
. ,
( - CompilePrimary file. ,
CompileClear primary file).
, , F6.

, (
, , ,
).
, .
F5
.
Alt-F3 .
.

.
. ,
.


.
, .
, ,
, . .
, .
. , .
. .
:
: EditCut - .
, .
( ). EditPaste - ,
, .
: EditCopy . - .
,
.


, , FileOpen
FileSave , , .
File Change dir .
, .
- !!!
! Edit Undo . Edit Redo
.
() Options Compiler Compiler Options Runtime Errors Range
Checking , ,
, , .
: , , ,
.

171
( )? - , -
.
.
, , ,
(File not found (GRAPH.TPU)), , Options Directories Unit
directories.
GRAPH.TPU. Units .
, 25 ,
Options Environment Preferences Screen Sizes
, , Options Environment
Colors. , .
, Window
Cascade Window Tile. Window List.
, Help.
- ,
, Ctrl-F1.
Sample Code, .
.

(exe)
- . ,
, , . -
,
exe ( , , ). 11
: Compile - , Destination (
) Disk, Memory ( ).
, . . Compile Compile -
exe , ,
pas.
Graph, . ,
, , ,
egavga.bgi ( ga.bgi, CGA)
( chr). BGI .

11
. ,
. , .

172

1.

,
. - ,
.


, - ,
" ". .
- , .
, .
. , , ,
,
.

. " Bubble Gum". ,


, - " ". ? - ,
(.0.4). .
"" - " ",
, . ( " ", ,
. , .)
- " _". , , ,
, ,
, , , , , ,
"_". , ,
.
"", "". "_". ,
"_".
,
BackSpace. . BS .
"" .
. " ",
"".
. "" "" , Shift
. - . ,
, "" - . Shift.
. Shift .
CapsLock .
.

173

.

CapsLock. CapsLock

. "Bubble Gum". ?
, - , . ,
. , .
,
, ,
, , .
,
. ,
. ,
, :

Shift + Shift

Shift. ,
Shift .
Ctrl
Ctrl . .
, .
Ctrl + Shift
.
, .
Alt + Shift
.
, Ctrl,
Alt, Shift.
, , .

. . ,
. , .
0 9.
. Shift.
, . , " ?"
Shift, - Shift. .
Shift. . .
. " Bubble Gum".
"". .
: .
. , . " " "".
, - , - ,
. " ", BackSpace.
, "" ,
, " " .
" Bubble Gum".
- Delete. Del.
"". " " "".
Delete. "", .
, BackSpace Delete ,
. .

. " Bubble Gum".


"" "". " " "".
"" . , " " ,
"" "Bubble Gum" .
" Bubble Gum".
, ,
. Insert, Ins,
, , " " "".
, Insert.

174
:


-,
- .



.
, , , ,
1.

. , , ,
? Enter, - Return, - .
. , .
- .
.
.
.
. ,
, . , .
, .
.
, .
. ,
. .
? ,
. ,
- . , ,
. .
, . ,
, .
.
.
- . ,
.
?
Delete.
? , - .


.
"" .
?
, .

Delete

. .
. , . :
, ,
, ,
- . - .
:

, .
,
, , , ,
. ,

175

. , .
, .
Delete , , , .
, . , , ,

, ,
.
BackSpace.

- . ,
. . ,
, . , - ,
. , .
,
- .
, ,
, .
.

2.
. , : , , ,
, . , ,
.
, , Sveta25. :
,
.
. - ,
, , , .
.
- , .
, - . - , .
, . , ..
. : , .
, , , ,
..
? , .
. .
, () Windows 95, Windows 98 Windows NT,
, .
, , -.
.


, .
, . MS-DOS .
, 8 , ,
- . Windows 95 Windows NT 255
. , ,
.
.
Windows 95 ,
, Windows 95 MS-DOS.
Red_Cat, .
. ( - 7.0)
MS-DOS , Windows 95
Windows NT.
, ,
. . , , ,
, Bulki.Ira.

176
,
. ,
Train, Train.pas.
, , . ,
.


, :



:
Games
Pascal
Letters
Games , : tetris.exe, arcanoid.com,
cat.exe.
:



Pascal :
Graph
Music
Other
Graph , , : train.pas, ball.pas.
, . ,
. . Letters
:
Igor
( )
Ed
( )
, Igor :
In
( )
Out( )
Ed. In Ed ,
, 25may97.txt 03june97.txt.
, :

177
\ Games
Pascal

Graph
Music
Other

Letters

Igor

In
Out

Ed

In
Out

, . , .
() , .
( Games, Pascal, Letters, )
. (, Music)
(Pascal), . Pascal
.
0.0.1.
. ()
, ,
, .
Windows Norton Commander.
, ,
- , . , ,
B:\Letters\Ed\In\25may97.txt. , .
,
-. .
. , - .
. , , ,
, . ,
. . ,
D, . . , .
, , , ,
, . - .
, B:\Letters\Ed\In\25may97.txt? ,
25may97.txt In, Ed, Letters,
, .
25may97.txt.
. : ,
, ., ., .1, .3, .. ,
, .

3. ,


( - )

Sqr (A)
Sqrt (A)
Pi
Frac (A)
Int (A)

A , - , A
A , - , A
-
A -
A -

178
Round (A)
Abs (A)
Random
Random (A)
Randomize

A , - LongInt
A , - , A
-
A - Word

A div B
A mod B

A B div -
A B mod -

CRT

Sound (A :Word)
NoSound
Delay (A :Word)
ReadKey :Char
KeyPressed :Boolean
TextColor (A :Byte)
TextBackground (A :Byte)
ClrScr
GotoXY (X,Y :Byte)

Graph
InitGraph (d,m :Integer; path :String)
CloseGraph

PutPixel (x,y :Integer; color :Word)


GetPixel (x,y :Integer) :Word
Line(x1,y1, x2,y2 :Integer)
Rectangle (x1,y1, x2,y2 :Integer)
Bar (x1,y1, x2,y2:Integer)
Bar3D (x1,y1, x2,y2:Integer; tol:Word; top:Boolean)
Circle (x,y :Integer; r :Word)
Arc (x,y :Integer; fi1,fi2,r :Word)
PieSlice (x,y :Integer; fi1,fi2,r :Word)
Ellipse (x,y :Integer; fi1,fi2, rx,ry :Word)
Sector (x,y :Integer; fi1,fi2, rx,ry :Word)
FillEllipse (x,y :Integer; rx,ry :Word)


( )

SetColor (color :Word)


SetLineStile (ls,uzor,tolsh :Word)
SetFillStyle(uzor,color :Word)
FloodFill(x,y :Integer; granitsa :Word)

GetMaxX :Integer
GetMaxY :Integer

GetImage (x1,y1, x2,y2 :Integer; var A12)


PutImage (x1,y1 :Integer; var A; mode :Word)
ImageSize (x1,y1, x2,y2 :Integer)

OutTextXY (x,y :Integer; stroka :String)


SetTextStyle (shrift,napravl,razmer :Word)
SetUserCharSize (A,B, C,D :Word)

DOS
GetTime (var chas,min,sec,sotki :Word)
SetTime (chas,min,sec,sotki :Word)
GetDate (var god,mes,den,dennedeli :Word)
SetDate (god,mes,den :Word)


Pos (s1,s :String) :Byte
Length (s :String) :Byte
Copy (s :String; a,b :Integer) :String
Delete (var s :String; a,b :Integer)

12
A -,
.

179
Insert (var s :String; s1 :String; a :Integer)


Assign (var f: Text; filename :String)
Rewrite (var f: Text)
Reset (var f: Text)
Close (var f: Text)
Append (var f: Text)

Chr (A :Byte) :Char


GetMem(P :Pointer; razmer :Word)
New (var p: Pointer)

4.
, , ,
in. , , , - ,
.
,
, .

180

Add watch
Alt
AND
Append
array
Assign
BackSpace
Bar3D
Begin
Boolean
Byte
CapsLock
case
Char
Chr
Circle
ClearDevice
Close
CloseGraph
ClrScr
Compile
Copy
CRT
Ctrl
Cut
Debug
Delay
Delete
DirectVideo
do
Double
downto
Edit
Ellipse
else
End
EOF
exe
Exit
Extended
false
File
FillEllipse
FloodFill
for
Forward
Frac
GetDate
GetImage
GetMaxX
GetMaxY
GetMem
GetPixel
GetTime
goto
Goto cursor
GotoXY
Graph
Halt
if
ImageSize
IMPLEMENTATION

InitGraph
Insert
Integer
KeyPressed
LABEL
Length
Line
LongInt
New
NormWidth
NoSound
of
Open
OR
Output
OutTextXY
Paste
PC Speaker
PieSlice
Pos
PROCEDURE
PROGRAM
PutImage
PutPixel
Random
Randomize
Read
ReadKey
ReadLn
Real
record
Rectangle
repeat
Reset
Rewrite
Round
Run
Save
Save as
SetColor
SetDate
SetFillStyle
SetLineStyle
SetTextStyle
SetTime
SetUserCharSize
Shift
ShortInt
Single
Sound
Sqr
Sqrt
String
Succ
Text
TextBackgrownd
TextColor
then
ThickWidth
to
TopOff
TopOn
Trace into
true

181
TYPE
UNIT
until
User Screen
Uses

Watch
while
Word
Write
WriteLn

182

5.
1

1. 5
2.
3. 3
4.
5. 2
6. 3
7.
8. 5
9.

2
1 2 5 + 1 6 = 1 4 1

3
1 9 9 2
4 8

!
3 6 .

: 3 0

4 0
5
VAR a,b : LongInt;
BEGIN
a:= 9000000;
b:= 1000;
WriteLn (a-b);
ReadLn
END.

6 : Constant out of range (.


IV).

7
8
9
10
11
12

211 .
1001
-100
15 -10
82

VAR dlina_dvora,
shirina_dvora,
pl_dvora,
svobodn_pl_dvora,
BEGIN
dlina_dvora:=50;
shirina_dvora:=30;

dlina_doma,
shirina_doma,
pl_doma,
dlina_zabora
dlina_doma:=20;
shirina_doma:=10;

pl_dvora := dlina_dvora * shirina_dvora;


pl_doma := dlina_doma * shirina_doma;
svobodn_pl_dvora := pl_dvora - pl_doma;

:Integer;

183
dlina_zabora := 2*(dlina_dvora+shirina_dvora)-(dlina_doma+shirina_doma);
WriteLn (pl_doma,'
ReadLn
END.

', svobodn_pl_dvora,'

', dlina_zabora);

13
VAR r :Integer;
{r- }
l, s :Real;
{l- , s- }
BEGIN
r := 800;
l := 2 * pi * r;
s := pi * r * r;
WriteLn (l :15:5, ' ', s:15:5);
ReadLn
END.

14
VAR t1, t2,
{t1- , t2- }
v1, v2,
{v1- , v2- }
s1, s2
:Integer; {s1- , s2-}
sredn_skorost :Real;
BEGIN
t1:=3;
t2:=2;
v1:=80; v2:=90;
s1:=v1*t1;
{ }
s2:=v2*t2;
sredn_skorost := (s1+s2)/(t1+t2);
WriteLn (sredn_skorost :10:3);
ReadLn
END.

15
VAR a,b,c, perimetr :Integer; {a,b,c - }
BEGIN
a:=20;
WriteLn (' ');
ReadLn(b,c);
perimetr := a+b+c;
{ - }
WriteLn (' ' , perimetr);
ReadLn
END.

16
VAR t, v, s :Real;
{t-, v-, s-}
BEGIN
WriteLn (' /');
ReadLn(s,v);
t:=s/v;
WriteLn (' = ', t :6:3, ' ');
ReadLn
END.

17

184
VAR r1, r2,
{r1- , r2-}
v1, v2,
{v1- , v2-}
t1, t2
:Real;
{t1- , t2-}
nazvanie1, nazvanie2
:String;
BEGIN
WriteLn(' ');
ReadLn(nazvanie1);
WriteLn(' ');
ReadLn(r1,v1);
WriteLn(' ');
ReadLn(nazvanie2);
WriteLn(' ');
ReadLn(r2,v2);
t1 := 2*pi*r1/v1; { = /, }
t2 := 2*pi*r2/v2; { * }
WriteLn (' ', nazvanie1, ' - ', t1: 3:0,
' ., ', nazvanie2, ' - ', t2 :3:0, ' .');
ReadLn
END.

18 8
19 29
20 66
21
VAR a1,a2 : Integer;
BEGIN
ReadLn (a1,a2);
if a1>a2 then WriteLn (a1+a2)
else WriteLn (a1*a2);
WriteLn(' ');
ReadLn
END.

22
VAR a,b,c : Integer;
BEGIN
ReadLn (a,b,c);
if a<b+c then WriteLn ('.')
else WriteLn (' , .');
ReadLn
END.

23
VAR golov, glaz, N : Integer;
BEGIN
WriteLn (' ?');
ReadLn (N);
if N<100 then golov := 3*N
else golov := 300 + 2*(N-100);
glaz := 2*golov;
WriteLn (' ', golov ,' ', glaz ,' ');
ReadLn
END.

24
VAR imya
:String;
Vozrast :Integer;

185
BEGIN
WriteLn (', , ?');
ReadLn (imya);
WriteLn (' , ', imya, '. ?');
ReadLn (vozrast);
WriteLn ('! ' ,vozrast, ' ! !');
if vozrast<=17 then begin
WriteLn (' ?');
ReadLn;
{ ,
}
WriteLn (' !')
end
else begin
WriteLn (' ?');
ReadLn;
WriteLn (' !')
end;
WriteLn (' !');
ReadLn
END.

25
VAR a,b,c : Integer;
BEGIN
ReadLn (a,b,c);
if a>=b+c then WriteLn ('')
else if b>=a+c then WriteLn ('')
else if c>=a+b then WriteLn ('')
else WriteLn ('');
ReadLn
END.

26

, , 180

184.

27
VAR a,b :String; {a- , b- }
BEGIN
ReadLn (a);
if a=' '
then b:='';
if a=''
then b:='';
if (a=' ')OR(a='')OR(a='')then b:='';
if (a='')OR(a='')
then b:=a;
WriteLn (b,'!');
ReadLn
END.

28
VAR bukva : Char;
BEGIN
WriteLn (' ');
ReadLn (bukva);
case bukva of
'','','','','','','','',''
:WriteLn('');
'','','','','',''
:WriteLn(' ');
'','','','','',''
:WriteLn(' ');
'','','','','','','','','','','' :WriteLn('');
else
WriteLn(' ')
end;

186
ReadLn
END.

29
VAR a,b,rez
: Real; {a b - , rez-}
Oper
: Char; {oper - }
BEGIN
ReadLn (a);
ReadLn (oper);
ReadLn (b);
case oper of
'+'
: rez:=a+b;
'-'
: rez:=a-b;
'*'
: rez:=a*b;
'/'
: rez:=a/b;
else
WriteLn(' ')
end;
WriteLn(rez :11:8);
ReadLn
END.

30 :

10
10
11
13
16
20

n:=n+1 WriteLn(' ') .

31
LABEL m1;

BEGIN

32
LABEL m1;
VAR
i :LongInt;
BEGIN
i:=1000;
m1: Write (i,' ');
ReadLn;
i:=i-1;
goto m1
END.

33
LABEL m1;
VAR
a :Real;
BEGIN
a:=100;
m1: Write (a :12:8,' ');
ReadLn;
a:=a/2;
goto m1
END.

m1: Write ('A');

ReadLn; goto m1 END.

187

34
LABEL m1,m2;
VAR
i :LongInt;
BEGIN
i:=1;
m1: Write (i,' ');
i:=i+1;
if i<100 then goto m1;
m2: Write (i,' ');
i:=i-1;
if i>=1 then goto m2;
ReadLn
END.

35
LABEL m;
VAR
a :Real;
BEGIN
a:=0;
m: WriteLn (a :5:3,' ', a*a :9:6);
a:=a+0.001;
if a<=1.00001 then goto m;
ReadLn
END.
: if a<=1 then if a<=1.00001 then .
, ,
0.001 1, - . , 0.999.
, 15 . . 12.2

36
LABEL m1,m2;
VAR
x,y,z :Real;
BEGIN
x:=2700;
m1: y:=x/4 + 20;
z:=2*y+0.23;
WriteLn ('x=',x:12:6,' y=',y:12:6,' z=',z:12:6);
if y*z<1/x then goto m2;
x:=x/3;
goto m1;
m2: ReadLn
END.

37
VAR Slovo
:String;
Nomer :Integer;
BEGIN
Nomer:=1;
repeat
WriteLn(' ');
ReadLn(Slovo);
WriteLn(Nomer, ' ', Slovo, '!');
Nomer:=Nomer+1;
until Slovo='';
WriteLn(' ');
ReadLn
END.

188

38
VAR a :Real;
BEGIN
a:=0;
repeat
WriteLn (a :5:3,' ', a*a :9:6);
a:=a+0.001;
until a>1.00001;
ReadLn
END.

39
VAR x,y,z :Real;
BEGIN
x:=8100;
repeat
x:=x/3;
y:=x/4 + 20;
z:=2*y+0.23;
WriteLn ('x=',x:12:6,' y=',y:12:6,' z=',z:12:6);
until y*z<1/x;
ReadLn
END.
: , repeat if
goto. - 36
, x:=8100 (, 8100/3 = 2700).

40
VAR t,s,h,v : Real;
BEGIN
v:=20;
t:=0;
repeat
s:= v*t;
h:= 100-9.81*t*t/2;
WriteLn('t=',t:5:1,' s=',s:8:2,' h=',h:6:2);
t:=t+0.2;
until h<=0;
{ - }
ReadLn
END.

41
VAR a : Real;
BEGIN
a:=900;
while a>=0 do begin { }
WriteLn('=', a :5:0, ' =', Sqrt(a) :7:3);
a:=a-3;
end;
ReadLn
END.

42
VAR i : Integer;
BEGIN
Write(' : ');
for i:=
-5 to
5 do Write(i,' ');
Write(' : ');

189
for i:=
5 downto -5 do Write(i,' ');
Write(' ');
ReadLn
END.

43
VAR i, N, a : Integer;
BEGIN
WriteLn(' ');
ReadLn (N);
for i:=1 to N do begin
WriteLn(' ');
ReadLn (a);
WriteLn(' =', a*a*a)
end;
ReadLn
END.

44 :
=300 =1200
=300 =1200
=300 =1200
2 3 .

45 .
46 :
10 .
.
, .
0 1, .
200 0 , .
47
VAR i, a, N, c_pol, c_otr, c_10 : Integer;
BEGIN
WriteLn(' ');
ReadLn (N);
c_pol:=0; c_otr:=0; c_10 :=0;
{ }
for i:=1 to N do begin
WriteLn(' ');
ReadLn (a);
if a>0
then c_pol:=c_pol+1;
{ }
if a<0
then c_otr:=c_otr+1;
{ }
if a>10 then c_10 :=c_10 +1;
{ 10}
end {for};
WriteLn(' - ',c_pol,' - ',c_otr,' 10 - ',c_10);
ReadLn
END.

48
VAR a, b, c : Integer;
BEGIN
c:=0;
repeat
ReadLn (a,b);

{ }
{ }

190
if a+b=13 then c:=c+1;
until (a=0) AND (b=0);
WriteLn(c);
ReadLn
END.

{ }

49
18
10
58
3
10
3
5

50
VAR i, dlina, shirina, S, sum: Integer;
BEGIN sum:=0;
for i:=1 to 40 do begin
ReadLn (dlina, shirina);
S:=dlina*shirina;
{S- }
sum:=sum+S
{sum- }
end {for};
WriteLn(sum);
ReadLn
END.

51
VAR i, ball, N, S : Integer;
BEGIN
WriteLn(' ');
ReadLn (N);
S:=0;
for i:=1 to N do begin
WriteLn(' ');
ReadLn (ball);
S:=S+ball;
end;
WriteLn(' =',S/N :8:3);
ReadLn
END.

52
VAR i, N
: Integer;
a, proizvedenie : Real;
BEGIN
WriteLn(' ');
ReadLn (N);
proizvedenie:=1;
{ , - !}
for i:=1 to N do begin
WriteLn(' ');
ReadLn (a);
proizvedenie := proizvedenie * a; { }
end;
WriteLn(' =',proizvedenie :12:3);
ReadLn
END.

53

191
VAR perv, vtor : Integer;
{p p p}
BEGIN
for perv:=3 to 8 do for vtor:=0 to 7 do Write(perv,vtor,' ');
ReadLn
END.

54
VAR i,j,k,l : Integer;
{p p}
BEGIN
for i:=1 to 3 do
for j:=1 to 3 do
for k:=1 to 3 do
for l:=1 to 3 do
Write(i,j,k,l,' ');
ReadLn
END.

55
VAR i,j,k,l, c : Integer; {c-}
BEGIN
c:=0;
{ }
for i:=1 to 3 do for j:=1 to 3 do for k:=1 to 3 do for l:=1 to 3 do c:=c+1;
Write(' = ', c);
ReadLn
END.

56
VAR i,j,k,l, c : Integer; {c-}
BEGIN
c:=0;
{ }
for i:=1 to 3 do
for j:=1 to 3 do
for k:=1 to 3 do
for l:=1 to 3 do
if (i<=j) AND (j<=k) AND (k<=l) then c:=c+1;
WriteLn(' = ', c);
ReadLn
END.

57
VAR i,N, chislo, min, nomer :Integer;
BEGIN
WriteLn(' ');
ReadLn (N);
{N - }
ReadLn(min);
{ }
nomer:=1;
{ p - p}
for i:=2 to N do begin
{pp }
ReadLn(chislo);
if chislo<min then begin { , }
min:=chislo;
{ }
nomer:=i;
{ p }
end {if};
end {for};
WriteLn(min,' ',nomer);
ReadLn
END.

58

192
VAR i,N, rost, min, max :Integer;
BEGIN
WriteLn(' ?');
ReadLn (N);
max:=0;
{, p 0 }
min:=500;
{, p 500 }
for i:=1 to N do begin
{pp }
WriteLn(' p ');
ReadLn(rost);
if rost<min
then min:=rost;
if rost>max
then max:=rost
end{for};
if max-min>40 then WriteLn('p') else WriteLn('Hp');
ReadLn
END.

60
USES CRT;
VAR hz, i : Integer;
BEGIN
for i:=1 to 3 do begin
hz:=60;
while hz<800 do begin
Sound(hz); Delay(50);
hz:=hz+5
end;
while hz>60 do begin
Sound(hz); Delay(50);
hz:=hz-5
end;
end{for};
NoSound
END.

{p p p p}
{ p}

{ }

61
USES CRT;
VAR hz, i : Integer;
BEGIN
for i:=1 to 30 do begin
Sound(60);
Delay(50);
Sound(400);
Delay(50);
end{for};
NoSound
END.

62
USES CRT;
VAR hz: Integer;
BEGIN
hz:=1000;
while hz<20000 do begin
WriteLn(' - ', hz, ' p. . 20000 .');
Sound(hz);
ReadLn;
hz:=hz+500
end;
NoSound
END.

193

64
USES CRT;
PROCEDURE doo; BEGIN Sound(523); Delay(500); NoSound; Delay(20)
PROCEDURE re;
BEGIN Sound(587); Delay(500); NoSound; Delay(20)
PROCEDURE mi;
BEGIN Sound(659); Delay(500); NoSound; Delay(20)
PROCEDURE fa;
BEGIN Sound(698); Delay(500); NoSound; Delay(20)
PROCEDURE sol;
BEGIN Sound(784); Delay(500); NoSound; Delay(20)
PROCEDURE la;
BEGIN Sound(880); Delay(500); NoSound; Delay(20)
PROCEDURE si;
BEGIN Sound(988); Delay(500); NoSound; Delay(20)
{500 - p , 20 - }
BEGIN
mi; doo; mi; doo; fa; mi; re; sol; sol; la; si; doo; doo; doo
END.

END;
END;
END;
END;
END;
END;
END;

65
USES CRT;
PROCEDURE doo; BEGIN Sound(523); Delay(500); NoSound; Delay(20)
PROCEDURE re;
BEGIN Sound(587); Delay(500); NoSound; Delay(20)
PROCEDURE mi;
BEGIN Sound(659); Delay(500); NoSound; Delay(20)
PROCEDURE fa;
BEGIN Sound(698); Delay(500); NoSound; Delay(20)
PROCEDURE sol;
BEGIN Sound(784); Delay(500); NoSound; Delay(20)
PROCEDURE la;
BEGIN Sound(880); Delay(500); NoSound; Delay(20)
PROCEDURE si;
BEGIN Sound(988); Delay(500); NoSound; Delay(20)
PROCEDURE chijik;
BEGIN mi; doo; mi; doo; fa; mi; re; sol; sol; la; si; doo; doo; doo END;
BEGIN
WriteLn(' "-". 1 ');
chijik;
WriteLn('2 ');
chijik;
END.

66
, , - ? - ?
-
, , ?
! , ?
, , -!
, ! , .
, ?
, - ?
! - !!!

67
USES Graph;
VAR Device, Mode: Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
Rectangle(300,30,360,80);
{}
Circle(330,120,40);
{}
Circle(345,110,5);
{}
Circle(315,110,5);
{}
Line(320,140,340,140);
{p}
Line(330,120,330,130);
{}
Line(330,120,305,130);
{}
Line(330,130,305,130);
{}
Circle(330,220,60);
{p}
Circle(330,360,80);
{}
Rectangle(350,163,455,183); {p}

END;
END;
END;
END;
END;
END;
END;

194
Rectangle(203,163,308,183);
Line(210,130,210,440);
ReadLn;
CloseGraph
END.

{p}
{}

68
USES Graph;
VAR Device, Mode: Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
Rectangle(300,30,360,80);
{}
SetFillStyle(1, yellow);
{}
FloodFill(330,50, white);
{}
Circle(330,120,40);
{}
Circle(345,110,5);
{}
Circle(315,110,5);
{}
SetColor(red);
Line(320,140,340,140);
{p}
SetColor(white);
Line(330,120,330,130);
{}
Line(330,120,305,130);
{}
Line(330,130,305,130);
{}
SetFillStyle(1, red);
{}
FloodFill(328,125, white);
{}
Circle(330,220,60);
{p}
Circle(330,360,80);
{}
Rectangle(350,163,455,183); {p}
Rectangle(203,163,308,183); {p}
SetLineStyle(0, 0, ThickWidth);
SetColor(blue);
Line(210,130,210,440);
{}
WriteLn(' ');
ReadLn;
CloseGraph
END.

69
x:=x+4;

70
x:=40;
repeat
Circle(x,100,10);
x:=x+4;
until x>600;

71
Circle(x,100,40);

72
USES Graph;
VAR x,y, Device, Mode :Integer;
BEGIN
Device:=0;

195
InitGraph(Device, Mode,
x:=40;
y:=470;
repeat
PutPixel(x,y,white);
x:=x+20;
y:=y-15
until x>600;
ReadLn;
CloseGraph
END.

'c:\tp\bgi');

73
USES Graph;
VAR r, Device, Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
r:=10;
repeat
Circle(320,240,r);
r:=r+15;
until r>230;
ReadLn;
CloseGraph
END.

74
SetColor(Yellow);
r:=50;
repeat
Circle(320,240,r);
r:=r+2;
until r>230;

75
y:=120;
r:=0;
repeat
Circle(320,y,r);
r:=r+3;
y:=y+2;
until r>200;

76
x:=40;
y:=40;
r:=0;
repeat
Circle(x,y,r);
x:=x+4;
y:=y+2;
r:=r+1;
until x>500;

77

196
y:=10;
repeat
Line(0,y,640,y);
y:=y+10;
until y>480;

78
y:=10;
repeat
{p :}
Line(0,y,640,y);
y:=y+10;
until y>480;
x:=10;
repeat
{p :}
Line(x,0,x,480);
x:=x+10;
until x>640;

79
y:=10;
repeat
Line(0,y,640,y);
y:=y+10;
until y>480;
x:=10;
repeat
Line(x,0,x-100,480);
x:=x+10;
until x>800;

{p :}

{ :}
{x-100 , }
{ 100 p}
{ p p p}

80
x:=50;
repeat
Rectangle(x,100,x+40,140);
{p p p
(100 140). p p p (x) p
(x+40) :}
x:=x+50;
until x>580;

81
USES Graph;
VAR i,j, x,y, Device,Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
y:=80;
{p :}
repeat Line(160,y,480,y);
y:=y+40;
until y>400;
x:=160;
{p :}
repeat Line(x,80,x,400);
x:=x+40;
until x>480;
Rectangle(155,75,485,405);
{P p }
{p p:}
SetFillStyle(1,Yellow);

197
y:=100;
for i:=1 to 4 do begin
x:=180;
for j:=1 to 4 do begin
FloodFill(x,y,White);
x:=x+80
end{for};
y:=y+40;
x:=220;
for j:=1 to 4 do begin
FloodFill(x,y,White);
x:=x+80
end{for};
y:=y+40;
end{for};
ReadLn;
CloseGraph
END.

{p p p}
{p p p }
{p }
{p p }
{p p p}
{p , p }
{p p }
{p p }
{p p p}
{p , p }

82
USES Graph;
VAR x,y, Device,Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
y:=40;
repeat
x:=40;
repeat
{p p p p:}
Circle(x,y,20);
x:=x+12;
until x>600;
y:=y+12;
{p p:}
until y>440;
ReadLn;
CloseGraph
END.

83

Circle(x,y,20)

84

Circle(x,y,20)
if
((x>150) OR (y<330))
AND
((x<260) OR (x>380) OR (y<180) OR (y>300))
then Circle(x,y,20)

85
USES Graph;
VAR i, Device,Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
for i:=1 to 30 do Circle(Random(640),Random(480),20);
ReadLn;
CloseGraph
END.

86
for i:=1 to 100 do begin

if (x>150) OR (y<330) then Circle(x,y,20)

198
Circle(Random(640),Random(480),Random(100));
SetColor(Random(15))
end{for};

87
USES Graph;
VAR i, Device,Mode :Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
Rectangle(300,100,400,250);
{}
for i:=1 to 100 do PutPixel(300+Random(100), 100+Random(150), Random(16));
ReadLn;
CloseGraph
END.

89
USES Graph, CRT;
VAR x, Device, Mode: Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
ReadLn; { , }
x:=40;
repeat
SetColor(White);
Circle(x,100,10); { }
Circle(x,200,10); { p }
Delay(10);
SetColor(Black);
Circle(x,100,10); {p }
Circle(x,200,10); {p p }
x:=x+1
{ }
until x>600;
{ p p p}
CloseGraph
END.

90
x:=40; y:=40;
repeat
SetColor(White);
Circle(x,100,10);
Circle(100,y,10);
Delay(10);
SetColor(Black);
Circle(x,100,10);
Circle(100,y,10);
x:=x+1; y:=y+1;
until x>600;

{ }
{ p }
{p }
{p p }
{}
{ p p p}

91
x:=40;
repeat
{ p}
SetColor(White); Circle(x,100,10);
Delay(10);
SetColor(Black); Circle(x,100,10);
x:=x+1;
until x>600;
{ p p p p}

199
repeat
{ }
SetColor(White); Circle(x,100,10);
Delay(10);
SetColor(Black); Circle(x,100,10);
x:=x-1;
until x<40;
{ p p p}

92

"" p p 91 p
repeat ........ until 2>3;

93
USES Graph, CRT;
VAR x,y, dx,dy, Device, Mode: Integer; {dx - p p,
p p
p p. dy - p}
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
Rectangle(35,35,605,445);
{p }
x:=320; y:=240;
{H p p}
dx:=1; dy:=1;
{Hp - p }
repeat
SetColor(White); Circle(x,y,10);
Delay(10);
SetColor(Black); Circle(x,y,10);
x:=x+dx; y:=y+dy;
if (x<50)OR(x>590) then dx:=-dx; {p p p,
p p p p}
if (y<50)OR(y>430) then dy:=-dy; {p p p,
p p p p}
if

(x<80) AND (y<80)


{ p p }
OR (x<80) AND (y>400)
{ }
OR (x>560) AND (y<80)
{ p p}
OR (x>560) AND (y>400)
{ p ,}
then
{ pp p :}
begin SetColor(White); Circle(x,y,10); ReadLn; Halt end;

until 2>3;
END.

94
USES Graph, CRT;
VAR x,y, x0,y0, Device,Mode : Integer;
t,s,h,v
: Real;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
Rectangle(20,40,40,440);
{}
Line(0,440,640,440);
{}
x0:=40; y0:=40;
{p p }
v:=20;
t:=0;
{H p p}
ReadLn;
{ p p}
repeat
s:= 4*v*t;
h:= 4*(100-9.81*t*t/2);
x:=x0+Round(s); y:= 400+y0-Round(h);{p, pp
Circle(x,y,3) p x y}
t:=t+0.05;
SetColor(White); Circle(x,y,3);
PutPixel(x,y,white);
{ }

200
Delay(100);
SetColor(Black); Circle(x,y,3);
until h<0;
SetColor(White); Circle(x,y,3);
ReadLn;
CloseGraph
END.

{pp p}

96
USES Graph, CRT;
VAR Device, Mode, x,r, y_red, y_yellow, y_green : Integer;
klavisha
: Char;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
x
r
y_red
y_yellow
y_green

:=320;
:= 50;
:=110;
:=240;
:=370;

{ p p p}
{ p p}
{ p p p}
{ p p}
{ p p}

Rectangle(x-100,40,x+100,440);
Circle(x,y_red, r);
Circle(x,y_yellow,r);
Circle(x,y_green, r);

{p p}

repeat
if KeyPressed then begin
{ - , :}
SetFillStyle(1,Black);
{p :}
FloodFill(x,y_red, White); {p , p}
FloodFill(x,y_yellow,White); {p , p}
FloodFill(x,y_green, White); { , p}
klavisha:= ReadKey;
if klavisha='r' then
{ r, p:}
begin SetFillStyle(1,red);
FloodFill(x,y_red, White)
end;
if klavisha='y' then
{ y, :}
begin SetFillStyle(1,yellow);
FloodFill(x,y_yellow,White)
end;
if klavisha='g' then
{ g, :}
begin SetFillStyle(1,green);
FloodFill(x,y_green, White)
end;
end{if}
until klavisha='q';
{ q, p-}
CloseGraph
END.

97
USES Graph,CRT;
VAR x,y, Device, Mode: Integer;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
ReadLn;
x:=750;
{ p }
repeat
{ ...}
SetColor(White);
Ellipse(x,100,0,360,50,10);
Delay(20);
SetColor(Black);
Ellipse(x,100,0,360,50,10);
x:=x-1

201
until KeyPressed;
y:=500;
repeat
SetColor(White);
Ellipse(x,100,0,360,50,10);
Ellipse(50,y,0,360,5,10);
Delay(20);
SetColor(Black);
Ellipse(x,100,0,360,50,10);
Ellipse(50,y,0,360,5,10);
x:=x-1;
y:=y-1
until y<0;
CloseGraph
END.

{ p, ,
p p:}
{ p p}
{p }
{p p}
{p }
{p p}
{p }
{p p}
{ p, p p p}

98-99
USES Graph, CRT;
VAR Device, Mode, x, y, d : Integer;
klavisha
: Char;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
x :=320;
{ p }
y :=240;
d :=5;
{ p }
PutPixel(x,y,White);
{P }
repeat
if KeyPressed then begin
{ - , :}
PutPixel(x,y,Black);
{p p }
klavisha:= ReadKey;
if klavisha='d' then x:=x+d; { d, p}
if klavisha='a' then x:=x-d;
{ a, }
if klavisha='z' then y:=y+d; { z, }
if klavisha='w' then y:=y-d;
{ w, p}
if klavisha='m' then d:=d+1; { m, }
if (klavisha='l') AND (d>0)
{ l ,}
then d:=d-1;
{ }
PutPixel(x,y,White);
{p }
end{if}
until klavisha='q';
{ q, p-}
CloseGraph
END.
p : p PutPixel - ,
"p" - p "p pp".

102

1) a[i] = a[i-1] + 4

2) a[i] = 2 * a[i-1]

3) a[i] = 2 * a[i-1] - 1

103
{ pp p p pp p ,
p p , :}
VAR t :array [1..7] of Integer; {t - pp 7 }
s,i :Integer;
{s - }
BEGIN { pp p:}
t[1]:=-21; t[2]:=-12; t[3]:=0; t[4]:=4; t[5]:=-5; t[6]:=-14; t[7]:=-24;
{p pp:}
s:= 0;
for i:=1 to 7 do s:=s+t[i];
WriteLn('p pp = ', s/7 : 6:2);

202
ReadLn
END.

104
VAR t :array [1..7] of Integer; {t - pp 7 }
c,i :Integer;
{c - p }
BEGIN { pp p:}
t[1]:=-21; t[2]:=-12; t[3]:=0; t[4]:=4; t[5]:=-5; t[6]:=-14; t[7]:=-24;
c:= 0;
for i:=1 to 7 do if t[i]<-20 then c:=c+1;
WriteLn('p ', c);
ReadLn
END.

105
min:=t[1];
for i:=2 to 7 do if t[i]<min then begin min:=t[i]; nomer:=i end;
WriteLn('Hp p - ', nomer);

106
VAR f :array [1..30] of LongInt;
I :Integer;
BEGIN
f[1]:=1; f[2]:=1;
for i:=3 to 30 do begin f[i] := f[i-1] + f[i-2]; Write(' ', f[i]) end;
ReadLn
END.

107
VAR t
:array [1..3, 1..4] of Integer;
i,j,min,max :Integer;
BEGIN
t[1,1]:=-8; t[1,2]:=-14; t[1,3]:=-19; t[1,4]:=-18;
t[2,1]:=25; t[2,2]:= 28; t[2,3]:= 26; t[2,4]:= 20;
t[3,1]:=11; t[3,2]:= 18; t[3,3]:= 20; t[3,4]:= 25;
{ p p p pp :}
min:= t[1,1];
max:= t[1,1];
for i:=1 to 3 do
for j:=1 to 4 do begin
if t[i,j]<min then min:=t[i,j];
if t[i,j]>max then max:=t[i,j]
end{for};
WriteLn (max-min);
ReadLn
END.

108
{p 1}
VAR t1_den, t2_den,
t_den
:1..30; {t1 - p p, t2 - p}
t1_chas, t2_chas,
t_chas :0..23; {p, t - p , den - }
t1_min, t2_min,
t_min
:0..59; {, chas - , min - }
minut,
minut1
:Word;
BEGIN
WriteLn(' p p( , , p p)');
ReadLn(t1_den, t1_chas, t1_min);

203
WriteLn(' p (, p p)');
ReadLn(t_den, t_chas, t_min);
{ p 0 p p:}
minut := 24*60*t_den + 60*(t1_chas+t_chas) + (t1_min+t_min);
{ - 24*60 }
{ p:}
t2_den := t1_den + minut DIV (24*60);
{ p 0 p p:}
minut1 := minut MOD (24*60);
{ p:}
t2_chas := minut1 DIV 60;
{ p:}
t2_min := minut1 MOD 60;
WriteLn('p p p ', t2_den,' ', t2_chas, ' . ', t2_min,' .');
ReadLn
END.

109
BEGIN WriteLn (Ord('') - Ord('') + 1) END.

110
TYPE

mes =(january, february, march, april, may, june, july, august,


september, october, november, december);

BEGIN
if september > june then WriteLn('p') else WriteLn('Hp');
ReadLn
END.

111
TYPE

Ochered = (Nina, Olga, Alex, Marianna, Ester, Misha, Tolik, Lena,


Oleg, Anton, Pankrat, Robocop, Dima, Donatello, Zina,
Sveta, Artur, Ramona, Vera, Igor, Ira);
CONST money : array [Nina..Ira] of Word =
(5,3,4,7,9,3,6,2,0,3,4,1,1,7,2,7,9,4,5,6,4);
{ array [Nina..Ira], array [Ochered]}
VAR
i
: Nina..Ira; { Nina..Ira, Ochered}
s
: Integer;
BEGIN
s:=0;
{ p }
for i:=Nina to Ira do s:=s+money[i]; {p }
if s>=300 then WriteLn('')
else WriteLn('H ');
WriteLn('Hp p p ', Ord(Lena)+1);
if money[Pankrat] > money[Misha]
then WriteLn('p')
else WriteLn('Hp');
ReadLn
END.

112 p +
113
VAR i :Integer;
BEGIN
for i:=32 to 255 do Write(chr(i),' ');
ReadLn
END.

204

114
VAR s :String;
i :Integer;
BEGIN
s:='p';
for i:=1 to Length(s) div 2 do begin
Write(s[2*i-1],s[2*i]);
Write('p');
end{for};

{Length(s) div 2 - p }
{ p p }

{ , :}
if Length(s) mod 2 = 1 then Write(s[Length(s)]);
ReadLn
END.

115
VAR ishodn, rezult :String; { pp p}
i
:Integer;
BEGIN
ishodn:='';
rezult:=' '; { , p rezult[i]:=}
for i:=1 to Length(ishodn) do rezult[i]:=chr(Ord(ishodn[i])+1);
WriteLn(rezult);
ReadLn
END.

116
TYPE

Family =
record
imya
:String;
god_rozd
:Word;
tsvet_glaz :String;
end;
CONST me :Family
=
{me - }
(imya:'Pp';
god_rozd:1984;
tsvet_glaz:'p');
uncle :Family
=
{}
(imya:'';
god_rozd:1940;
tsvet_glaz:'p');
aunt :Family
=
{}
(imya:'';
god_rozd:1950;
tsvet_glaz:'');
VAR i : Integer;
BEGIN {p, p - 1999 }
WriteLn (1999 - me.god_rozd,' ',me.tsvet_glaz);
if uncle.god_rozd < aunt.god_rozd then WriteLn('p')
else WriteLn('Hp');
ReadLn
END.

118
CONST kol = 10;
VAR
bukvi :set of ''..'';
i
:Integer;
BEGIN
Randomize;
{ bukvi}
bukvi:=[ ];
{ " "}
for i:= 1 to kol do bukvi := bukvi + [chr(Ord('')+Random(32+1))];
{ . 32 - p
ASCII, Ord('')+Random(32+1) - p
}
if ('' in bukvi) OR ('' in bukvi) OR ('' in bukvi)
then WriteLn('')
else WriteLn('H ');
ReadLn

205
END.

119
USES Graph;
VAR x,y,razmer, Device, Mode :Integer;
PROCEDURE treugolnik(x,y,razmer:Integer);
BEGIN Line (x,
y, x+razmer,
y);
Line (x,
y, x+razmer div 2, y-razmer);
Line (x+razmer, y, x+razmer div 2, y-razmer);
END;
BEGIN
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
treugolnik(320,240,100);
treugolnik(200,100,20);
ReadLn;
END.

120
FUNCTION Power(Osnovanie:Real; Stepen:Word) : Real;
VAR a:Real; i:Word;
BEGIN a:=1;
for i:=1 to Stepen do a:=a*Osnovanie;
{
Power:=Power*Osnovanie, p pp p
Power pp}
Power:=a
END;
BEGIN
WriteLn(Power( 5,2) : 30:10);
WriteLn(Power(23,0): 30:10);
ReadLn
END.

121
USES Graph;
FUNCTION x(x_nov:Integer):Integer; BEGIN x := x_nov + 320 END;
FUNCTION y(y_nov:Integer):Integer; BEGIN y := 240 - y_nov END;
VAR d,m:Integer;
BEGIN
d:=0;
InitGraph(d,m,'c:\tp\bgi');
Circle(x(310),y(230),10); {p p p p}
PutPixel(x(0),y(0),White); { p p}
ReadLn
END.

122
TYPE vector = array [1..5] of Byte;
FUNCTION max (c:vector) :Byte;
VAR i,m :Integer;
BEGIN m:=c[1]; for i:=2 to 5 do if c[i]>m then m:=c[i]; max:=m END;
FUNCTION min (c:vector) :Byte;
VAR i,m :Integer;
BEGIN m:=c[1]; for i:=2 to 5 do if c[i]<m then m:=c[i]; min:=m END;
FUNCTION raznitsa (c:vector) :Byte;
BEGIN raznitsa := max(c)-min(c) END;
CONST a :vector = (4,2,3,5,5);
{ a}

206
b :vector = (4,3,3,4,3);
{ b}
BEGIN
if raznitsa(a) > raznitsa(b) then WriteLn('P b')
else WriteLn('P a');
ReadLn
END.

123
CONST k=7;
TYPE vector = array [1..k] of Integer;
PROCEDURE termo (var c:vector; popravka:ShortInt);
VAR i,m :Integer;
BEGIN for i:=1 to k do c[i]:=c[i]+popravka END;
CONST a:vector = (14,12,13,15,15,12,13); { pp a}
b:vector = (-4,-3,-3,-4,-3,-2,0);
{ pp b}
VAR i:Word;
BEGIN
termo (a,-2);
WriteLn('H pp :');
for i:=1 to k do WriteLn(a[i]);
termo (b,3);
WriteLn('H pp b:');
for i:=1 to k do WriteLn(b[i]);
ReadLn
END.

124
FUNCTION fib(N: Word): LongInt;
BEGIN
if N=1 then fib :=1;
if N=2 then fib :=1;
if N>2 then fib :=fib(N-2)+fib(N-1)
END;
VAR i:Word;
BEGIN
for i:=1 to 35 do Write(fib(i),' ');
ReadLn
END.
p , . -
pp.

125
{ p - pp () p
p, pp , pp (p)
p. pp, pp .
p p p.
p, pp ,
p p.}
CONST M=3; N=4; {M - p , N - }
TYPE
matritsa = array[1..M,1..N] of Word;
CONST a
: matritsa = ((2,6,4,2),
{ }
(9,1,8,3),
(5,7,3,8));
VAR i,j :Word;
PROCEDURE puziryok_2 (var mass:matritsa; M,N:Word);
VAR i,j, i1,j1, k :Word; {i - p, p p, j - ; i1-p, p
p p, j1 - , k - p }

207
c
:Integer;
LABEL metka;
BEGIN
i1:=M; j1:=N;
for k:=1 to M*N-1 do begin
{ p 1 , }
for i:=1 to M do
{p p p}
for j:=1 to N do begin {p p}
if NOT ((i<i1)OR(i=i1)AND(j<j1)) then goto metka; { p p,
}
if j<>N then
{ p:}
if mass[i,j]<mass[i,j+1] then begin
c:=mass[i,j];
mass[i,j]:= mass[i,j+1];
mass[i,j+1]:=c
end{if};
if (j=N)AND(i<>M) then { p p p
p :}
if mass[i,j]<mass[i+1,1] then begin
c:=mass[i,j];
mass[i,j]:= mass[i+1,1];
mass[i+1,1]:=c
end{if}
end{for j};
metka:if j1>1 then j1:=j1-1
{, p}
else begin j1:=N; i1:=i1-1 end
end{for k};
END;
BEGIN
puziryok_2 (a,M,N);
{P pp :}
for i:=1 to M do begin
for j:=1 to N do Write (a[i,j],' ');
WriteLn
end{for};
ReadLn
END.

133
USES Graph, CRT, DOS;
VAR Device, Mode
: Integer;
Chas1, Min1, Sec1, Sotki1,
Chas2, Min2, Sec2, Sotki2, React : Word;
BEGIN
DirectVideo:=false;
Device:=0;
InitGraph(Device, Mode, 'c:\tp\bgi');
WriteLn(' p, ');
Randomize;
Delay(1000+Random(20000));
Rectangle(100,100,300,300);
GetTime(Chas1,Min1,Sec1,Sotki1);
ReadLn;
GetTime(Chas2,Min2,Sec2,Sotki2);
React := 100*(Sec2-Sec1) + (Sotki2-Sotki1);
WriteLn('p p - ',React,' ');
ReadLn
END.

134

208
USES DOS;
VAR God, Mes, Den, Den_Ned, God1, Mes1, Den1, Den_Ned1
: Word;
Den_Ned_Text
: String;
BEGIN
GetDate(God, Mes, Den, Den_Ned);
{ }
WriteLn(' , p ');
ReadLn (Den1, Mes1, God1);
SetDate(God1, Mes1, Den1);
{ p }
GetDate(God1, Mes1, Den1, Den_Ned1); { p }
case Den_Ned1 of
{ p }
0 :Den_Ned_Text:='p';
1 :Den_Ned_Text:='';
2 :Den_Ned_Text:='p';
3 :Den_Ned_Text:='p';
4 :Den_Ned_Text:='p';
5 :Den_Ned_Text:='';
6 :Den_Ned_Text:=''
end;
WriteLn(Den1, '.' ,Mes1,'.',God1,' - ', Den_Ned_Text);
SetDate(God, Mes, Den);
{ }
ReadLn
END.

6.
.., .. ( 5.5). ,
, 1992 . 576 .
,
. , , .
. , 5.5. 7.0 . ,
1992 , . .
.. - (6.0). , - , 1992 . 304
.
.. Turbo Pascal 6.0 , , 1992 . 298 .
.. , , 1988 . 220 .

209

7.
A
Abs...................................................39
Add watch......................................168
Alt...................................................173
AND.................................................51
Append...........................................148
Arc..................................................152
array................................................108
Assembler.........................................16
Assign.............................................147
B
BackSpace......................................173
Bar..................................................152
Bar3D.............................................152
Basic.................................................16
BEGIN..............................................31
Boolean...........................................113
Byte................................................107
C
C 16
CapsLock........................................172
Case..................................................53
CD-ROM..........................................27
Char..........................................53, 116
Chr..................................................116
Circle................................................80
ClearDevice......................................81
Close...............................................147
CloseGraph.......................................78
ClrScr.............................................154
Comp..............................................107
Compile..........................................171
const...............................................111
Copy.......................................117, 170
CRT....................................77, 96, 154
Ctr...................................................173
Cut..................................................170
D
Debug.....................................163, 166
Delay................................................71
Delete.....................................117, 173
DirectVideo......................................89
div.....................................................38
do................................................60, 62
DOS................................................155
Double............................................107
downto..............................................62
E
Edit.................................................170
Ellipse...............................................81
else....................................................46
END..................................................31
EOF................................................148
exe..................................................171
Exit...........................................75, 162
Extended.........................................107
F
false................................................113
File..................................................162
FillEllipse.......................................152

FloodFill...........................................82
for.....................................................62
FORWARD......................................96
Frac...................................................39
G
GetDate...........................................155
GetImage........................................153
GetMaxX........................................152
GetMaxY........................................152
GetMem..........................................153
GetPixel..........................................152
GetTime..........................................155
GOTO...............................................56
Goto cursor.....................................169
GotoXY..........................................155
Graph........................................77, 151
H
Halt...................................................75
I
if 46, 48, 50
ImageSize.......................................153
IMPLEMENTATION....................150
in 121
InitGraph..........................................78
Insert.......................................117, 173
Int.....................................................39
Integer.......................................35, 107
INTERFACE..................................150
Internet.............................................27
K
KeyPressed...............................96, 100
L
LABEL.............................................56
Length.............................................117
Line...................................................80
LISP..................................................16
Logo.................................................16
LongInt.....................................36, 107
M
mod...................................................38
N
new.................................................123
New................................................162
NormWidth.......................................81
NoSound...........................................71
NOT..................................................52
O
of 108
Open.......................................163, 170
OR....................................................52
ORD...............................................115
Output.............................................166
OutTextXY.....................................153
P
Pascal................................................16
Paste...............................................170
PC Speaker.......................................26
Pi 39
PieSlice...........................................152
Pos..................................................117

PRED..............................................116
PROCEDURE..................................74
PROGRAM....................................135
Program reset..................................166
Prolog...............................................16
PutImage.........................................153
PutPixel............................................79
R
Random......................................39, 84
Randomize........................................85
Read..................................................42
ReadKey...................................96, 100
ReadLn.....................................42, 148
Real...........................................40, 107
Record............................................119
Rectangle..........................................79
Repeat...............................................59
Reset(..............................................148
Rewrite...........................................147
Round...............................................39
Run.................................................163
S
Save................................................163
Save as............................................163
Sector..............................................152
set of...............................................120
SetColor............................................81
SetDate...........................................155
SetFillStyle.......................................82
SetLineStyle.....................................81
SetTextStyle...................................153
SetTime..........................................155
SetUserCharSize.............................154
Shift................................................172
ShortInt...........................................107
Single..............................................107
Sound................................................71
Sqr....................................................39
Sqrt...................................................39
str....................................................154
Str...................................................117
String..............................................117
SUCC.............................................115
T
Text.................................................147
TextBackgrownd............................154
TextColor.......................................154
then...................................................46
ThickWidth.......................................81
to 62
TopOff............................................152
TopOn.............................................152
Trace into........................................165
true..................................................113
TYPE..............................................112
U
Unit.................................................150
until...................................................59
User Screen....................................163
V

210
val...................................................154
Val..................................................117
var.....................................................35
W
Watch.............................................166
While................................................60
Word...............................................107
Write.................................................30
WriteLn....................................36, 147
31
- 38, 120
.
. 31
(
( 38
)
) 38
*
* 38, 120
/
/ 38
^
^ 123
+
+ 38, 117, 120
=
= 34

.....................39
...............................................122
.............................................123
......................................10
..........................................104

.......137

...........................38
.........38

.......................................16

.................................119
............................23, 28, 104, 122
..............................................28
....................................................28

........................................16, 24

...........................161
........................................19
.....................107
......................39

......................................................23

...................................25
.......................................25
.........................................21

........................................26

......................................68
if...............50

..........136

..........................68

..........136

.24
........................24, 26

......................39
.......................................155


. .149

...............................................19
................................138


.......................................153

..................13, 74
..........................................23

..............163

..................................137

.........................161
if.......58

...................................64

...................................100
......................................27
...............129

...........................................77

......................77

..........................................23
..............................................155

......85
.....................109

.............................................176

.................................139

.........................39

.........................................24
..................45

..........................................55
....................................114

........................................123

...............149
............................................26

......................................10, 21
....................................22, 26

............................................9
............................................25
.................................175
.......................................177
.......................39

..................................................46

...................................26

.................126

.........................150

........................................23

.....................162

....................................................100
............................................81

............................................82
...........................................118

............................................119

....................104
..................................85
..................................................71
.................................26
.........................34

......................................................34

51
................................38
........................................88
.......................................100

.................................................52
.........................37

..............................74

...............................175

..............................150
.................................................175
................................................46
....108

.......................................131


.........................................78
........................................64

................43

.....................171

...................164

............................................113
............................23

211
...........................................175

......................................24

......................................21

............................104
......................157

.................................27

.............................................10
.................................170
............................................16
.....................12
...................................31

-................................27

....................................35
...................................9, 10
......................27
................................45, 112

.................................170

.........................................152

.........................39
....................177
...........................................177
........................................24, 33

...............................................123

................................................123

..........................26
.................................................16
................137
.....................50

Boolean...............113
......................177
.........113
...........113

..................................................16

...............................................113

................128

........................................27

..................................69
............................................108
..........................................129

........................................108
..............129
.....................................38
.......................25

.............................14

...............................................56

.............................133
.......................88

.......................................25

...................................70

..................................120
..............................................27

Graph.................................151

.................150

.....................................39, 150
CRT...................................154
DOS..................................155
Graph..................................77

..........................................25

.........................................9

...............................................24

52


......................................156

.........13, 74

...........................................157

....................114

..................108

......................................39
......................................80
.....................................137
........................21

.......................23

.......................26
..........................................16

..........................................75
.........................53
.........................56

................138
......................36
...............................59

For........................61
Repeat..................59
While....................60

....................................29
.................34

..............42

-...............30

..................23

...................35

......................74

.................111
....................................................23

.....................18


......................................................38

.....................164

..........................................18

Repeat While
......................................................61

...............................80

..............................................23
..............................................21
..............................................175
-.......................130
-...................130
...................79

............................................16
......32

.........87


.............78

....................34
..........................62
.....................................37
...................83

............108
................................170
........139
,
.........................113

...............115
..............................24
............21
......................................................39
........................................15, 28

............................................26

....................133
.............................121
...............................128

.................................................60

..............................................119

212
.................................11
............................54
.........................113



......................................................22
,

........................................95
..........159
. 40

............17


...................................23

........165, 166, 169


IF........48

\....................31
.......................107

........112
...........................................25
........................................105
.......................................14

-................................87

...............................11
.................13
.....................................10

.............................................16
.................72

.......................78
................................107
........................40

() 30

..........................................73
........................................75

Write................30
WriteLn...........33

......................................13
...........................15, 19, 71

..........125

........................................21
................................79
..............................116
.........................120
..............................................177

.....169
......................116
.......46
.....150,
151

.........150, 151
..........................75
.............................75
.........150, 151

.........................................38


.................122

.................................175
....................116
.........................................23

........................................131
....................................65

. 27
..................................................27
.....................................................16

................................27, 53, 116

Char..................116
...............53

.........................................48
.........140
..........................79
..............................21

..............................................25
.............................................38

...............................107

if. . .50

............................31
..................................104
.............98
.............................39
........................84

...............19
...................137

..................................132

.......................49
...............162
................................12
................................106

............................................123

...........................................107

..........75, 77
...............77

........................................122, 131

..................................82

....................................81

.......................135

.............................................117

.................137
.................44
String...................117

..............................................44

.........................25
..................135
..136

) ...........106
....................75

....50

..........................................67

......................................67

............................................65

.........................................65

...........................61

ASCII...............................104
.......................................154, 155
....................172
.........................155

...........................77

........................147
............................74
.....................................57

.............................137

..............................112
.........112

. 64

..............................................139
46
..............................................31

............................31

................................................79
......................................95

.......................................153
.........................................38
......................................78
..............24


..................................96

...................23

213

.......................................154


................................116

........................46
............................24
...................24, 25
.21

...............................................147
...........................147


..........................................175

...........................................175
...............126
.............138
...............126

...............129

..................................138

.............138
........................................127

..................................................81
.................................................81
..............................................79
...........................39
..................38

...................107

.................21
..................................................18

.................................................56
...............56

..........................108

.............................107

.................................................21
........................................154

.........40
...............138
..............................................81

................77

.............15

............................................139
..............................................36

............................................35

214