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

,.


__________________________________________________________

1999


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

I. ...................8
1. ........................................................................9
1.1. ..........................................................................................................................................9
1.2. . .......................................................................................9
1.3. ........................................................................................................................11

2. ....................................................................................................12
2.1. . ..............................................................................................12
2.2. ......................................................................................................................................13
2.3. . ?....................................................................................................13
2.4. ......................................................................................................14
2.5. ............................................................................................................................................15
2.6. ...............................................................................16
2.7. .....................................................................................17
2.8. .......................................................................................................................18

3. ...................................................................................................21
3.1. .............................................................................................................................21
3.2. ...............................................................................................................23
3.3. ...........................................................................................................................23
3.4. ...............................................................................................................................24
3.5. ...................................................................................................................27

II. ...................29
4. () . -. .........30
4.1. Write...............................................................................................................................................30
4.2. .....................................................................................................................................31
4.3. .........................................................................................................32
4.4. WriteLn. ............................................................................................................................33
4.5. . ......................................................................................................34
4.6. (VAR)......................................................................................................................................35

4.7. ...........................................................................................................36
4.8. .......................................................................................................................................................37
4.9. . .....................................................................................................38
4.10. .................................................................................................................................39
4.11. ...............................................................................................................40
4.12. ReadLn Read...............................................................................................................42
4.13. ............................................................................................................................................43
4.14. ..............................................................................................................................................44
4.15. ...............................................................................................................................................45
4.16. ....................................................................................................................................................................45

5. .........................................................................................................46
5.1. IF .......................................................................................46
5.2. IF.......................................................................................................................................48
5.3. ......................................................................................................................................................49
5.4. ..................................................................................................................................50
5.5. if. if. ...............................................50
5.6. Char....................................................................................................................................53
5.7. case................................................................................................................................................54

6. .................................................................................................................56
6.1. GOTO. . ....................................................................................................................56
6.2. if......................................................................................................................................58
6.3. repeat..................................................................................................................................................59
6.4. while...................................................................................................................................................60
6.5. repeat while..............................................................................................................................61
6.6. for........................................................................................................................................................61

7. ..................................................................................................64
7.1. ..................................................................................................................64
7.2. ..................................................................................................................................................................65
7.3. ........................................................................................................................................................................65
7.4. .....................................................................................................................................................................67
7.5. ............................................................................................................68
7.6. .........................................................................................................................................................68
7.7. ...................................................................................................................................69

8. ..........................................................................................................................................71
8.1. .........................................................................................................................................................71
8.2. ...............................................................................................................................................72
8.3. ...............................................................................................................................................75
8.4. Halt Exit............................................................................................................................75

9. ...............................................................................................................................................77
9.1. .....................................................................................................................................................77
9.2. Graph, .............................................................................77
9.3. ........................................................................................................................................78
9.4. . . ....................................................................................................81

9.5. .......................................................................................................83
9.6. ..................................................................................................84
9.7. .....................................................................................................................................85

10. ..........................................................................................87
10.1. ......................................................................................................................................................87
10.2. -..........................................................................................................87
10.3. ..........................................................................................................89
10.4. ...............................................................................................................................91
10.5. ...............................................................................................................................92
10.6. , .........................................................95
10.7. . ReadKey KeyPressed..........................................................96
10.8. .......................................................................................................................................................97
10.9. . ....................................................................................................100

III. ...............103
11. .........................................................................................104
11.1. ......................................................................................................................................................................104
11.2. .........................................................................................................................................................104
11.3. ............................................................................................................................................105

12. ..............................................................................106
12.1. .............................................................................................................................................................106
12.2. ..........................................................................................................................................................107
12.3. .....................................................................................................................................................................108
12.4. ..............................................................................................................................................111
12.5. .....................................................................................................................................112
12.6. .....................................................................................................................................112
12.7. Boolean...........................................................................................................................................113
12.8. .................................................................................................................................................113
12.9. ().................................................................................................................................114
12.10. ......................................................................................................................115
12.11. Char. .........................................................................................................116
12.12. String. ...........................................................................................................117
12.13. .......................................................................................................................................................................118
12.14. ...............................................................................................................................................................120
12.15. . ..............................................................................122
12.16. .....................................................................................................................................................................123

13. .......................................................................................125
13.1. .......................................................................................................................................125
13.2. .....................................................................................................................................................................127
13.3. . ........................................................................................128
13.4. ...........................................................................................................................................129
13.5. - -....................................................................................................130
13.6. . . ........................................................................................................................................131
13.7. ................................................................................................................................................................133

14. ........................................................................................................................135
14.1. ..............................................................................................................................................135
14.2. ..............................................................................................................................136
14.3. .................................................................................................................................................................137
14.4. ...............................................................................................................................................137
14.5. ..........................................................................................................................................138
14.6. ....................................................................................................................................139
14.7. .............................................................................................................................................................139
14.8. ..................................................................................................................140

15. ......................................................................................................147
15.1. ........................................................................................................................................147
15.2. ....................................................................149
15.3. ..............................................................................................................................................150
15.4. Graph........................................................................................152
15.5. .............................................................................................................152
15.6. ......................................................................................................................154
15.7. ( CRT)........................................................................................154
15.8. ( DOS)............................................................................................................155
15.9. ...............................................................................................................156
15.10. ..........................................................................................................................157

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

. .......................................................171
1. ............................................171
2. ........................................................................................................................174
3. , ..................................................................................176
4. ................................................................................................................................177
5. .........................................................................................................................................................180
6. .....................................................................................................................................................207
7. ................................................................................................................................................208


,
, .
,
.

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

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

0.2. ?
, , . .
, , ,
. , , . , - ,
. , , . .
. , , , .

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

?
, , 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.3.
:
I. . . - ,
. :

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

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

IV. . TurboPascal 7.0.


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

I.

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

. ,
.

.0

0.1.
- , . ,
. .
:

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

0.2. . .
? , - .
. ? , , , - -. , , 17
, . , .
, :
1.
2.
3.
4.
5.
6.




,
1
,

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

- .
- .
- .
.

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

, . ,
.

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

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

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

. , - .
, , . ,
, . , , , : " ?"
, 2500. , "
?" ..
. , ,
- , - ..
, , , ,
, - .

.1
1.1. .
, . , . ,
, . :






, , , .
, .

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

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

, , .
, , , :

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

4.

, , , ,
, , , , ,
.
.

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

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

1.
2.
3.

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

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

- . , ,
( ).

, :
.
, .

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

4.

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

1.5.
? , , , .
. , , , - ,
( , , ).

- , 2
, :





,
,

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

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

Logo

Basic
Pascal

C
Assembler

LISP, Prolog

, ,

,
,

,
, , ,

,

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

3 + 2
:

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

1.6.
. . .
, :

, . .
:

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

28 , ,
28 .
60 .

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

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

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

? . ,
.

1.7.
, . (.1.1):
0.
1.

2.
3.

4.

5.

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

1.8.
. . , - , . , ,
, 0.1? , , . !
, , .
. .
, , , , , . , ,
, .

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

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

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

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

( )

( ). ,
:
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.
" - ?"
5.
.
6.
. . . . . . . . . . . . . .
.............
( , ,
).
. .
.

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

, :

()

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

, . -
, , . :
1.

2.

3.

4.

. .
, , - ()
. () . ,
, . ( .)
, .
.
. ,
. . ( , , , ,
. .)
, , ( ) -
, . , . ,
. , , ,
, .
, , .
, ( ) , ""
, . ( 3)
, . ,
( ). , ,

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

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

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

2.4.
, "" .
. , :

, , .
, , .
, , .
, .

2.4.1.

.
1. . . .
, , , , .
2. . " " ,
. . : "", "", "", "".
- , , , "", -
, , "". , .
. .
, ,
.
, ,
-, .
3. . , . .
, , .
4. . , : " ""
" "?". , . :
, . -
. . - ,
, .
, . , , "", .
, . , .
, , "? , .
, . ,
. , , .
5. . , - .
6. . , () .
.


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


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

5. . , .
.


.
1. ( ). : 1) ,
. - , . 2)
, , 128 1024
( 1 ) . , , ,
, 1000 . , ,
, .
"" -
. , (. ).
, . ,
, 40000 200000 .


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

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

. .
.
, , (, , )
.
. , -
, .
,
. .
, ?
. , , ;
- . , , ,
. .
Internet.

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

.-

---.

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


, - .
, -.
5

, .
. . .
, , , :

, .
, , 3 .
8 . "" .
, , .
, -
. , -
. - - , - ,
.
, ( ). ,
111
100

010

001

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

, , , , .

II.

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

.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
, (, ) , .
, , :
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(
)

Write( 8 +1
-2) END.

'!')
;Write( 5

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

enD.

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

8+1)

{ 5 2
{ }

!}
;
}

, , , ,
. , , , -
, , 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. identifier, - . Write.

Wite(!). Unknown

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

Syntax error, . ,

10. -
) expected, .

Write(!), Write (! .

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
WriteLn
WriteLn
WriteLn;
WriteLn
END.

(
('

'

M
'

6*6,

'.

!'
:'

(1992);
);
(6*8);
(6+4)*3)

: * . , .
? , , , . 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;

88
s
88
88
8 80 88
1008 800 88

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)

, := , . :=34,
34:=. z:=f-v+990 , f-v+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 .
:
:= , , - , .
" " ( )
, .

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

0.6. (VAR)
0.5 , . .
- BEGIN, . :
VAR
BEGIN
a:=100;
b:=20;
WriteLn
END.

a,b

(a

Integer;

b)

, 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, .
, , Integer, LongInt (
Long Integer - , ). LongInt 4
-2147483648 2147483647.
5: =9000000 . - b=1000 . ,
. .
6: . LongInt, Integer. ?

0.7.
:
VAR
BEGIN
a:=
b:=
y:=
WriteLn
END.

a,b,y

Integer;

10;
6;
a+b+1;
(y+200)

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
b
y

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

10
10
10
10

?
6
6
6

?
?
17
17

217

WriteLn:
WriteLn , ,
, .

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


0.7.1.


, . :

VAR
BEGIN
k:=10;
END.

k
WriteLn

(k);

:
k:=25;

WriteLn

(k);

Integer;
k:=4;

WriteLn

(k)

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) .
?
VAR
BEGIN
f:=30;
f:=f+4;
WriteLn
END.

WriteLn (k) 25. k:=4 25 ,

Integer;

(f)

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


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

f:=f+4 f , , f 4.

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)

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).
. , .
.
( ) :

2
4
2

+
*
/

10
5
17 div 5
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, , , ,
, 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)
,
.
:

Sqr(2+1)

10+Sqr(2+1)

1+Abs(5-8)

Sqr(2)+Sqrt(35+1)

Sqrt(8+Int(41.5))

21 div (Round(Pi+1))

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

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

sin, cos, arctan, exp, ln Randomize. ,

11: , :

9
19
4
10
7

VAR
BEGIN
a:=(Sqr(2)+1)*(20b:=11
WriteLn
END.

a,b:

Integer;
Sqr(2*2))-11;
(a-4);
(Sqr(a)+b-1)

div

0.10.
:
VAR
BEGIN

a,b,y

:
a:=10;
y:=

Integer;
a

/
WriteLn

b:=6;
b;
(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 . .

:
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 .
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.

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


kol_krol

kol_slon

norma_krol

norma_slon

vsego

norma_krol:=2
norma_slon:=100
ReadLn (kol_krol)
kol_slon:=3
vsego:=norma_krol
WriteLn (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),
, ,
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

0.15.
, :
:
, , ?
:

:
, . . ?
:
16
:
! 16 ! !
:
VAR imya
vozrast
BEGIN
WriteLn
ReadLn
WriteLn
ReadLn
WriteLn
END.

:String;
:Integer;
(',
('
('!

,
',

'

,vozrast,

imya,

'

'

?');
(imya);
?');
(vozrast);
!')

, . , :

:
,

?
:
!
:

,
!
.

?
:
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

.1
1.1. IF
1.8. , ( ,
) ().
, .
:
if
""
""
then
""
""
else
""
""
:

IF

a=28 THEN WriteLn (f)

ELSE

k:=44

k 44.

a=28

, , , 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 - . :

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
BEGIN
ReadLn (Slovo);
if
WriteLn
END.

Slovo
{

Slovo

Slovo
=

''

then

String;

Slovo

:=

}
'';
(Slovo)

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 .
.5.1 , if :
THEN
, , .
. . :
IF

IF

THEN

[ ELSE ]

, , .
: , if, . ,
b:=6; if b+1>0 then s:=20 - b 6, 7. WriteLn.
: 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

: ,
, s.

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

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
WriteLn ('
end

');

(a,b);

'

,a+b)

, ,
, , , , , 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, , - .
: . 28, , . ?
: 30, , .
:
VAR
BEGIN
ReadLn
if a>28 then if a<30

then
else
else WriteLn ('

WriteLn ('

Real;
(a);
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 .
.
- :
VAR
BEGIN
ReadLn
if (a>28) AND (a<30) then
else
END.

:Real;

WriteLn ('

(a);
WriteLn ('')
')

" ". .
:
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, ...
6

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

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
END.

then WriteLn ('');


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

. 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
BEGIN
ReadLn
WriteLn (c3,c2,c1)
END.

c1,c2,c3:

Char;
(c1,c2,c3);

ReadLn , WriteLn . ReadLn,


, , .
Enter. , ReadLn . , Char
String. , - .

1.7. case
, . ,
:
VAR Otmetka: Integer;
BEGIN
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)
then
else

OR

if
then
else

(Otmetka=2)
WriteLn('!')

Otmetka=3
WriteLn('')
if

then
else

Otmetka=4
WriteLn('')
if

then
else WriteLn(' ')

Otmetka=5
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
- - 12 ..18 . , 12,13,14,15,16,17,18.
.
-, else. , a:=3 a:=0, case,
, , else, , .

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

.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
BEGIN
m1:Write ('
Write ('
Write ('');
Write ('
');
goto
END.

m1;
');
');
m1

,
? IV. ,
:
( ) Ctrl-Break ( ,
, Ctrl, Break). .
, , . ,
. , Ctrl-F2.
, , . , Write (' ') GOTO m1.
:
LABEL
VAR
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.

a,k

8;
Integer;

m1,met5;
Integer;

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
VAR

n,k

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
. .

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
. , .

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
BEGIN
Write('
f:=3;
m1: Write(f,'
f:=f+2;
if f>9 then
else
m2: Write('
END.

Write('

')

END.

Integer;

');
');

goto
goto

m2
m1;
')

:
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.
0.000 0.001 0.002 0.003 . . . 0.999 1.000.
36) =2700, 900, 300, 100 . . . .. y=x/4 + 20 z=2y+0.23 , yz 1/.
35) " "- 6

: , , , ,
. ? , 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
else
goto
Write('

');

REPEAT
VAR
BEGIN

Write('
f:=3;
repeat

Integer;

Write(f,'

');
');

f:=f+2;
until f>9;

m2
m1;
')

Write('

')

END.

,
if f>9 then goto m2 else goto m1.
repeat:

repeat m1, until f>9

REPEAT ; ;. . . ; UNTIL
repeat : , repeat until, ,
.
repeat :
, repeat, until,
, until. ,
.. , repeat
.
: , , .
, "". , " "
.
, . Slovo.

VAR
BEGIN
repeat
WriteLn('
ReadLn(Slovo);
WriteLn(Slovo,
until
WriteLn('
END.

Slovo

String;
');

'!')
Slovo='';
')

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 :

while a>b do b:=b+1.

, 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.
, do
.

WHILE
VAR
BEGIN

Integer;

Write('
');
f:=3;
while
f<=9
do
begin
Write(f,'
');
f:=f+2;
end;
Write('

')
END.

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

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

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, .
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
BEGIN

i
for

Integer;

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
BEGIN
for
begin

i
i:=10
Write(i);
Write('

:
to

200

Integer;
do
')

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

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

.3
, , , ,
. . , ,
, , .

3.1.
: 40 . , . .
:
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;
{ }
V:=S*visota;
{}
WriteLn(S, ,V)
40 , for:
VAR
i,
BEGIN
for i:=1 to 40 do begin
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;
V:=S*visota;
WriteLn(S, ,V)
end
END.

dlina,

shirina,

visota,

S,

V:

Integer;

{for}

, 1.4 , end
begin, for. , . ,
. , end, {for}.
, , ,
:
VAR
i,
BEGIN
WriteLn( );
ReadLn (N);
{N - }
for i:=1 to N do begin
WriteLn( , );
ReadLn (dlina, shirina, visota);
S:=dlina*shirina;

dlina,

shirina,

visota,

N,

S,

Integer;

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

43: N . .

3.2.
1.2 , . ,
V:=S+visota, :
=300 =304
=600 =605
=50 =53

V:=S*visota

for i:=1 to N for i:=2 to N :


=300 =1200
=600 =3000
. , 1 2 , 2 3? ,
, , , .

44-45:
, ,
44) for i:=1 to N do begin ReadLn (dlina, shirina, visota)
45) WriteLn( =,S, =,V) 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

, , . ,
?
. .
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.
.

46: ,
1)
2)
3)
4)
5)

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 : Integer;
simvol
:Char;
BEGIN
i:=0; cW:=0; cDv:=0;
{ }
repeat
{ }
ReadLn (simvol);
{ }
i:=i+1;
{ }
case simvol of
'W':cW:=cW+1;
{ W, W}
':' :cDv:=cDv+1
{ :, :}
end
until simvol = '/';
{ /}
procent_W
:=Round(100*cW/i); { W}
procent_Dv
:=Round(100*cDv/i); { :}
WriteLn(procent_W,' ',procent_Dv)
END.

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

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.

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


1)
2)
3)
4)

s:=0 s:=10.
s:=s+a s:=s+a+1.
end {for} WriteLn .
s:=0 for .

5) for ReadLn .
6) s:=s+a end {for} .
7) for i:=1 to N for i:=2 to N.

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

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*1=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
a:=1;
b:=1;
proizv:=a*b;
Write(a, * ,b, = ,proizv)
Write 5 :
*0 a,
*1 *,
*2 b,
*3 =,
*4 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,
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

{1}
{2}

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.

{3}
{4}
{5}
)

{6}
{7}
{8}
{9}
{10}

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

53-56:
53)
54)
55)
56)

- 3 8, - 0 7. , 36, 44, 80.


, 1,2,3. , 2123, 3312, 1111.
.
, , - 1123, 1223, 2222 .., 3322.

3.7.
: .
: .
: . .
, . , , , , .
: , , max.
. ( chislo) max. , max
.
10 :
VAR i, chislo, max :Integer;
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
.?

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

4.1.
, . , :
USES
BEGIN
Sound(300)
END.

CRT;

:
, , Uses CRT. ,
, 5.1, .
Sound(300) 300 ().
Sound , . , , , . Sound(300) - .
Sound(6000) - , , . Sound(40) - , .
, , . ? ? ! ,
, , . - . ,
- . , , .
. - . - .
- , NoSound:
USES
BEGIN
NoSound
END.

CRT;

NoSound ( , ), . : ,
NoSound. !
:
USES
BEGIN
Sound (300); Delay (2000); NoSound
END.

CRT;

Delay (2000). , . ,
2000 , , 2 . Delay (1000) 1 ,
Delay (500) - .. ( , ).
, Sound (300) . Delay (2000) 2 .
, . 2 NoSound. . ,
300 2 .
:
USES
BEGIN
Sound(900);Delay(1000);Sound(200);Delay(3000);NoSound
END.

CRT;

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, :











59-63:

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) Delay(1000) hz:=hz+40


(). .
60) , : - - - - .
61) , ,
.
62) . , , 10000-20000
. . ,
, , . ,
. ReadLn.
63) , .

4.2.
: , .
, : ( )
( ). .
( , - ):
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
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);

CRT;
{}
{}
{}
{}

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;
BEGIN
{ P:} tochka; tire; tire; tochka; Delay(300);
{ I:} tochka; tochka;
Delay(300);
{ P:} tochka; tire; tire; tochka; Delay(300);

{ I:} tochka; tochka;


{ N:} tire; tochka;
{ G:} tire; tire; tochka;
END.

Delay(300);
Delay(300);
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;

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 . :
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 (' - ')
PROCEDURE ARAMIS;
BEGIN WriteLn (' , , -!')
PROCEDURE PORTOS;
BEGIN WriteLn (' ! , ?');
Aramis;
7

END;
END;

, ,

WriteLn (' , ! , .')


END;
PROCEDURE DARTANIAN;
BEGIN WriteLn (' , - ?');
Exit;
WriteLn (', ?');
Portos
END;
BEGIN
WriteLn (', , - ? - ?');
Atos;
WriteLn (' , , ?');
Portos;
WriteLn (' , ?');
dArtanian;
WriteLn ('! - !!!');
Halt;
WriteLn (' , !');
END.
, . , .
, .
, .2.

.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.

() - .
.
8

. ,
25 80 , .
. , .
.
, -
. 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 . , .
. :
1 2 3 4 5 6 7 8 9 1011 12 13141516

640

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

, . . , 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, , - .
=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); { }
, ( ) .
:

, , :

? 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.

, . ,
, , :

SetFillStyle(1, Yellow) FloodFill( , ,Blue ).

, 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
ReadLn;
CloseGraph
END.

x>290;

69: . , , , ,
, .
70: . .
71: . .
. , ,
. - - x.
USES
VAR

Graph;
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
ReadLn;
CloseGraph
END.

< >);

x>290;

, 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))
, - , , 100. , WriteLn (500 + Random(100))
500 599.
. (,
1000). PutPixel. ? Random. 640 480 ,
:
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
CloseGraph
END.

{ }
{ }
{ }
x>600;

, -
. - .
Delay -
.

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

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 (): : . ?
. . .

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


.
2

Graph. .4.

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

6.1.
.
: :
1) :

2)
3)
4)
5)

( 5).
( ) ( ).
.
. .

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

5)
6)
, , , , .
, (), ().
, . :
*5
Landscape
*6
Music
*7

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

House

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

-

- ,

- . ,

-

-

: 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;
VAR Device, Mode :Integer;
PROCEDURE Tree;
BEGIN WriteLn( )
END;
PROCEDURE House;
BEGIN WriteLn( )
END;
PROCEDURE Landscape;
BEGIN
WriteLn( );
WriteLn( ); { }
WriteLn( );
{ }
WriteLn( );
{ }
WriteLn( );
{ }
Tree;
{ }
Tree;
{ }
Tree;
{ }
House;
{ }
House;
{ }
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.

{ }
{ }
{ }
{ }

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











3




. . ,
.

6.4.
0.11 , . ,
, . , -
.
3 -. .
USES
VAR

Graph;
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);
Circle(x,100,10);
x:=x-shag
until
until 8>9
END.

x<lev

, , 2 6 .
, , , , ,
.

6.5.
. .
. , .
, , ,
! ? 10 .
, 10 . 10 . 10
100 , 10 . , .
10 , -?
, , .
, ( ). ,
: VAR y_goriz. y_goriz:=240. Line (0,
y_goriz, 640, y_goriz). . ,
.
. . ? . .
. , . .
. - , , .
, , .
.
, . , - 640 480.
, .
. 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);
{ :}
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;
.
.
:
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);
SetFillStyle(1,Brown);
FloodFill (x_tree,
y_tree + 40,
White);
END;
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);

x_house:=300; y_house:=400. House

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);
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. , :
PROCEDURE P2;
P2
BEGIN.
P1 .....
P1
END;
PROCEDURE P1;
P1
BEGIN .....
P2 .....
P2
END;
BEGIN .....
P1 .....
P1
END.

P1 P2, P2

, 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
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.
.
, . . , ,
. , ,
. , , ,
, . , , ,
, , . ,
, .
, , ,
, . - , . ,
, 16 - 16 , .
!, :

:
!

- :
!

:
!

15- 16- :
!

17- ,

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

ReadKey

ReadKey:

, - , - .
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),
. , !, 10,
!, 8 . , .
( , ):
USES CRT,Graph;
VAR


PROCEDURE ZAVERSHENIE_IGRI; , , , ,
, . , NACHALO, - Halt.
PROCEDURE NE_PORA_LI; . >10, ZAVERSHENIE_IGRI, RISUNOK.
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.

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

III.

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

, ,
.
.

.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
const
end
forward
AND
constructor
export
function
array
destructor
exports
goto
asm
div
external
if
assembler
do
far
implementation
begin
downto
file
in
case
else
for
index

inherited
inline
interface
interrupt
label
library
mod
near
nil

not
object
of
or
packed
private
procedure
program
public

record
repeat
resident
set
shl
shr
string
then
to

type
unit
until
uses
var
virtual
while
with
xor

asm, .

0.3.

.
( ).
.
, , .
.

.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


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

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


( )
11-12
2.910-39 - 1.71038
-45
38
7-8
1.510 - 3.410
15-16
510-324 - 1.710308
-4932
4932
19-20
3.410
- 1.110
19
19
-10 10



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.

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],
9

Comp, , , .

:
,
,

f[1]=1

f[2]

..

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: , :
1) 14 18 22 26 .....
2) 6 12 24 48 ....
3) 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.
:
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[1]+a[2]+a[3] , a[2]+a[3]+a[4] , a[3]+a[4]+a[5] , ...... , a[8]+a[9]+a[10] .

... , 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.

. , ,
. . .
1
2
3
1)
2)
3)
4)

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]
, (), - () .
:

{ 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 .
, . ,
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}
, . ,
, - , . , ,
. .

1.5.
CONST , . - ,
, , , -
. :
CONST n :Integer
=800;
e :Real
=2.7;
1.4, t :
CONST k =7;
10

{ 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 d . ,
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 .

TYPE

? . . - -
, . , , ,

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


,

PROCEDURE p(a: Vector)
.

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. , - .
.
CONST Zachet :array[1..6]
VAR
c,i
:Integer;
BEGIN
c:=0;
for
i:=1
to
WriteLn(c)
END.

of

Integer

{c
6

(1,1,0,1,1,1);

do

Zachet 6

if

zachet[i]

then

}
c:=c+1;

Boolean. true , false - .


CONST Zachet :array[1..6]
VAR
c,i
:Integer;
BEGIN
c:=0;
for
i:=1
to
WriteLn(c)
END.

of

do

Boolean

(true,true,

if

zachet[i]

false,

true,

true

true,

true);

then

c:=c+1;

, 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. , .
.
: , . ?
.
:
CONST dni:array[1..12]
VAR
s,i :Integer;
BEGIN
s:=0;
for i:=6 to 8 do s:=s+dni[i];
WriteLn(s)
END.

of

Byte

{
{

(31,28,31,30,31,30,31,31,30,31,30,31);

}
6,7,8}

- ,
(6 8). . -,
:
TYPE

mes =(january,

CONST dni
VAR

s
i

BEGIN
s:=0;
for
WriteLn(s)
END.

february,

march,
october,

april,

:array[january..december]
(31,28,31,30,31,30,31,31,30,31,30,31);
:Integer;
:mes;
i:=june

may,
of

to

june,
november,

july,

august,

Byte

august

do

september,
december);
=

s:=s+dni[i];

: , 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. , . ,
, .
. ( ).
, :
VAR Otpravlenie, Pribitie : 0..24;
BEGIN
Otpravlenie:=22;
Pribitie:=Otpravlenie+10;
WriteLn(Pribitie)
END.

0 24.

VAR Otpravlenie, Pribitie : 0..24 , Otpravlenie Pribitie

, ()
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
Succ('')
''
Succ (we)
th
4. PRED - predecessor - successor "". PRED . :
Pred (25)
24
Pred('')
''
Pred (tu)
mo

, , . ,
for , :

y:=10+Ord(we)+Succ(8) y 21.

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),
, 69 ASCII, .. ''.
112: , , Write(Chr(Ord(Succ(Pred('+')))))

c1

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.
, :

Page Up
Insert
Tab
F1
F5
F9

0
0
0
9
0
0
0

72
73
82
59
63
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

s3:=s1+s2
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'

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.

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. . , , .
, , . .

1.13.
100 . : 1) , ,
; 2), 10 ; ..
, , , : ,
, .
102 : 1) , 2) .
, . 102 , 101 102 .
VAR nazvanie :array[1..102] of String; {
skorost :array[1..102] of Real; {
torped :array[1..102] of Byte;
{
i
:Integer;
BEGIN
{
-

for
i:=1
to
100
do
END.

102
102
102

nazvanie[1]:=''....

if
skorost[i]
>
skorost
[101]

then

, :

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
?

}
}
}

, .
. , , , , :

,
}
:}
WriteLn(nazvanie[i])

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

.
, . - ()
, . , , , : - ( 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;

,
(.

:=22;
{
for i:=1 to 100 do if
END.

:}
.

prot.torped

lodka[i].skorost

>

vr.skorost

then

WriteLn

:}
(lodka[i].nazvanie)

, .
, :
TYPE

podlodka = record
nazvanie
:String;
skorost
:Real;
torped
:Byte;
end;
CONST lodka
: array[1..3] of podlodka
=
((nazvanie:'';
skorost:26;
(nazvanie:'';
skorost:14;
(nazvanie:''; skorost:28;
vr
: podlodka
=
(nazvanie:'';
skorost:20;
prot
: podlodka
=
(nazvanie:'';
skorost:18;
VAR
i
: Integer;
BEGIN
for
i:=1
to
3
do
END.

torped:

torped:15);
torped:22);
if

lodka[i].skorost

>

vr.skorost

, record.
116: . :



. :
1)
2) , .

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

then

WriteLn(lodka[i].nazvanie);

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] [ ], .

if a = b then ...
if a <> b then ...
if a <= b then ...
if a >= b then ...

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

a
b

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]
i, j, k
:Integer;
BEGIN
{

Randomize;
for
i:=
1
Medium[i] :=Random(razmer+1);
Extrasens[i] :=Random(razmer+1)
end
{

k:=0;
{

for
i:=
1
for
j:=
if
Medium[i]
k:=k+1;
WriteLn(Medium[i])
{

of

0..razmer;

to

kol

to
1
to
=
Extrasens[j]

:}
do

.
kol

begin

k
do
kol
then

{for};
:}
}
do
begin
}

end
if k=0 then
END.

WriteLn(

{if};
)

. 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
:set
i
:Integer;
BEGIN
{ :}
Randomize;
Medium:=[ ]; Extrasens:=[ ];
{
for
i:=
1
Medium
:= Medium +
[Random(razmer+1)];
Extrasens := Extrasens+
[Random(razmer+1)]
end
a:= Medium * Extrasens;
if a=[ ] then
else
WriteLn(

{
WriteLn(

of

0..razmer;

to
{
{

,
{
for i:=0 to razmer do if i in a then WriteLn(i);

kol

end
END.

do

}
begin
}
}
{for}
.}
)
begin
);
a:}
{else}

118: . ,
,,.

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

1 = 1024 . : - , - . , ,
.
, , . ,
, " " :
1-1

64

0
.
, , VAR, CONST .. ( ).
, ( 64). - , ,
( , - .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
BEGIN
a:=2;
y:=a+b;
WriteLn
END.

a,

b,

Integer;
b:=3;
(y)

, 2 5 (, , ). :
VAR b
:
a,y
:
BEGIN
New(a);
a^ :=
y^ :=
WriteLn
END.

Integer;
^Integer;
New(y);
b:=3;
b;
(y^)

2;
a^

: , 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
VAR

D
DP
Int
i, j
m

BEGIN
New(i);

=
=
=
: Int;
: DP;

array[1..10]
{
{

i,
-

of
-

New(j);

10

Real;
^D;
^Integer;
}
}
New(m);

i^:=4;
j^:=3;
j:=i;
WriteLn(j^);
m^[9]:=300
END.

{
{
{

4}
4}
300}

. MS-DOS , , ,
, 64, :
TYPE

a
= array[1..200]
ap
= ^a;
a2
= array[1..200]
VAR
x
: a2;
)}
BEGIN
for i:=1 to 200 do New(x[i]);
............
x[128]^[35]:=800;
.............
END.

of

Integer;

of
{x - 200 ( - 200

{
{

ap;

}
}

, , , , ..

.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;


END.

octava:=4; dlit:=1000; re;

octava:=3; dlit:=2000; re

, . :
BEGIN
re(3,1000); re(4,1000); re(3,2000)
END.
. , :
USES CRT;
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)
END.
. ,

Nota(re,3,8)

a:=3; Nota(re, a,

11-a).
119: Graph , . .
: .

2.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: . Power : Power(2,3)


3

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

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.

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.
. .
= 20, = 30 Z = 40.
. = 20 = 30.
= 1 Z = 40.

2)
3)
4)
5)
6)

.
. . ,
. ( -, ).

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.
sum(a), c
sum(b), c b.

a.

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. - -
, , , - .
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 .
, . - , - - - .

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(N-1).

Factorial

? .
, WriteLn(Factorial(3)).
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, .
.
. (,
- Factorial :=2*1=2.
. (,
- Factorial :=3*2=6. .

N=2)

N=3)

.
, .
. 64K.
. , . , ,
, , .
? ,
, . : - .
? , ,
.

124: fib .

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

5 4 2).

: 100 . .
, , , .
100 ? 100 .
, , ( 0).
. .
10 :
CONST N
= 10;
TYPE
vector
= array[1..N] of Word;
CONST massiv_ishodn
: vector =(3,8,4,7,20,2,30,5,6,9); { }
VAR
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;
BEGIN
for m:=Razmer downto 2 do begin
{ 9}
for i:=1 to m-1 do begin
{i }
if mass[i]>mass[i+1] then begin { }
c:=mass[i];
{ }
mass[i]:= mass[i+1];
{ c}
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.

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] >=

.3
,
. ,
.

3.1.
:

BEGIN

END.

, , . - , , ,
BEGIN END. :

BEGIN

WriteLn(1993);

WriteLn(1994)

END.

, , .
:
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 .

BEGIN.

:
PROGRAM Divan;
USES
Crt,Graph;
LABEL
met1,met2;
CONST
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
.......
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 f2. a1 a11 f11. f2 a21.
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 .
, , .

VAR a: Integer; b: Word;


BEGIN .... a+b ...

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

, , 1 2, :

(sun, mon, tue, wen)


(sun, mon, tue)
String
Char
1 - , 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)
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.

, , . .
,
(. ).
Array *

String

3.7.

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

,
set,
Byte.
, , . , ,
,
. .
Set

Char
Boolean

*)

**)

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

__

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



, , .
. , ,
.

BEGIN
BEGIN

END.
END.

PROGRAM
PROGRAM

;;

USES
USES


,,




;;


;;


goto
if

::


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

(record).

case
repeat
while
for


with

==

::

;;

CONST
CONST

==

;;

: . 12.5

TYPE
TYPE

==

;;

*)

Real
Single Double Extended
Comp.

.


^^

Pointer
Pointer

:

Char
Char

Integer
LongInt
Word
Boolean
Boolean
Byte

ShortInt.

....

((

,,

))

array
array

[[

,,

record

,,
record
record

of
of

]]

::

:
end
end

;;

set
setof
of

[[

string
string

]]

.


,
,

LABEL
LABEL


,,

PROCEDURE
PROCEDURE

VAR
VAR

,,

;;

;;

FUNCTION
FUNCTION

::

::

;;

BEGIN
BEGIN

BEGIN
BEGIN

END
END

END
END

. 6.6

,,

VAR
VAR

((

::
;;

..

:=
:=


[[

,,
^^

]]

))

case
case

((

))

,,

goto

of
of
goto
goto


case

;;

if

ifif

....

then
then
::

,,
;;
else
else

;;
end
end

else
else

;;

repeat

repeat
repeat

while

for
for

while
while

until
until

downto
downto

do
do

for

to
to
:=
:=

do
do

;;
begin
begin

end
end

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


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

,

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

,
.

, ,
, .

.4
. .

4.1.
, - .
. , . ,
, - , , .
. - . ,
, . , - ,
, , - .
, , .
: 1998 c: fedos, PASCAL.
, fedos , .
, 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 :

fepas.


1998
WriteLn Write, :

1998
fedos , Rewrite .
, .
, - , 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 :
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 END;
PROCEDURE sol; BEGIN Sound(784); Delay(300); NoSound END;
PROCEDURE la ; BEGIN Sound(880); Delay(300); NoSound END;

PROCEDURE si ; BEGIN Sound(988); Delay(300); NoSound 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.

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))
END.

{ 2 , 8}

, .
:
st $I.
st , .
, . :
UNIT Mathemat;

st.

{ }

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 ( , ).
. , .
, 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 ,
. :

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;
:Word)
Sector
(x,y
fi1,fi2,rx,ry :Word)

rx,ry

:Integer;

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
Graph;
VAR
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);
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
Graph,CRT;
VAR
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
, 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
. 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. , , 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

. 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 . :

-

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

, - .


. , , ,
(, )
F1 .
, , : , , , .
, -, . ,
, , . ,
- .
: ,
. - . ,
: - . ,

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

IV.

. , , .

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


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





, 6
(5)

3
(6)
.

(1)
, . , , , . ,
50 50.
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
, . , .
( ). , .
. , , .
, . - , -
. . , . . .

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

, - .
, . - . .

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

- File Exit.

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

, , , , ( ..),
. . ,
Windows, - (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,
, , , .
, .

. , .
, ( !). ,
. (

ReadLn ). , , ReadLn,
.

. , , , . ,
, . ,
, , .
( ) Ctrl-Break. .
, , . ,
. , Ctrl-F2.

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

Unexpected
of file

end

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

Line too long

(
, ).

Disk full

. -
Lower
bound
, array[2..5] array[5..2] .
greater than upper

bound

Invalid
floating
Sqrt(-25) a/0 -
point operation

Ordinal

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


expression

expected
Error
in , k:=*8 k:=**8
expression
Range check error

, , 1.9
Constant out of


range

Invalid
numeric
, , ReadLn(k) VAR
format

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).
, 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.
.
then V:=a1*a1*a1, else V:=a2*a2*a2.

ReadLn (a1,a2) , 2 3. if a1>a2

F7 RunRun (
. , Run Program reset ( Ctrl-F2).

Ctrl-F9)


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

Integer;

m1: Write(' ');


ReadLn;
k:=k+1;
goto met5;
WriteLn(' ')
END.
: :

10
10
11
13
16
20

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

, . , 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.
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.
FileNew, FileOpen,
.
, , . , , ,
. . ,
( - CompilePrimary file. , CompileClear primary file).
, , F6.

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

. .
, .


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

: EditCopy . - .
, .


, , FileOpen FileSave ,
, . FileChange dir .
, .
- !!! ! EditUndo
. EditRedo .
() OptionsCompilerCompiler OptionsRuntime Errors Range Checking ,
, , , .
: , , , .
( )? - , -
. .
, , , ( File not found (GRAPH.TPU)),
, Options Directories Unit directories.
GRAPH.TPU. Units .
, 25 , OptionsEnvironmentPreferencesScreen
Sizes
, , Options Environment Colors. ,
.
, Window Cascade Window Tile.
Window List.
, Help. -
, , Ctrl-F1.
Sample Code, .
.

(exe)
- . , ,
, . - ,
exe ( , , ). 11

11

. , . ,
.

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

1.

,
. - , .


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

. " Bubble Gum". , , -


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

. "" "" , Shift .


- . , , " " - . Shift.
. Shift .
CapsLock .
. 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.


:


-,
- .



.
, , , ,
1.

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

- . ,
.
? Delete.
? , - .


.
"" .
?

Delete , .

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

.

. , . ,

Delete , , , . ,

. , , , , ,
.
BackSpace.

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

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

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


, . ,
. MS-DOS . , 8 , ,
- . Windows 95 Windows NT 255 .
, , .
. Windows 95
, , Windows 95 MSDOS. Red_Cat, .
. ( - 7.0) MS-DOS
, Windows 95 Windows NT.
, , . .
, , , , Bulki.Ira.
, . ,
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.
, :
\ Games
Pascal

Graph
Music
Other

Letters

Igor

In
Out

Ed

In
Out

, . , . () ,
.
( Games, Pascal, Letters, )
. (, Music) (Pascal), . Pascal
.
0.1.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)
Round (A)
Abs (A)
Random
Random (A)
Randomize

A , - , A
A , - , A
-
A -
A -
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)
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)
12

A -, .

Append (var f: Text)

Chr (A :Byte) :Char


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

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


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
TYPE
UNIT
until
User Screen

Uses
Watch
while
Word
Write
WriteLn

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

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

6 : Constant out of range (. IV).

7 211 .
8 1001
9 -100
10 15 -10
11 82
12
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
:Integer;
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;
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
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
19
20
21

8
29
66

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;
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+cthen 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;
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.

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.

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(' : ');
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);
{ }
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
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;
end {if};
end {for};
WriteLn(min,' ',nomer);
ReadLn
END.

{ }
{ p }

58
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.

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);
{}

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

Circle(330,220,60);
Circle(330,360,80);
Rectangle(350,163,455,183);
Rectangle(203,163,308,183);
Line(210,130,210,440);
ReadLn;
CloseGraph
END.

{p}
{}
{p}
{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;
InitGraph(Device, Mode, 'c:\tp\bgi');
x:=40;
y:=470;
repeat
PutPixel(x,y,white);
x:=x+20;
y:=y-15
until x>600;
ReadLn;
CloseGraph
END.

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
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
{p :}
Line(0,y,640,y);
y:=y+10;
until y>480;
x:=10;
repeat
{ :}
Line(x,0,x-100,480); {x-100 , }
{ 100 p}
x:=x+10;
until x>800;
{ 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);
y:=100;
{p p p}
for i:=1 to 4 do begin
{p p p }
x:=180;
{p }
for j:=1 to 4 do begin
{p p }
FloodFill(x,y,White);
x:=x+80
{p p p}
end{for};
y:=y+40;
{p , p }
x:=220;
{p p }
for j:=1 to 4 do begin
{p p }
FloodFill(x,y,White);
x:=x+80
{p p p}
end{for};
y:=y+40;
{p , p }
end{for};
ReadLn;
CloseGraph
END.

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;
until y>440;
ReadLn;
CloseGraph
END.

{p p:}

83

Circle(x,y,20)

84

Circle(x,y,20)

if (x>150) OR (y<330) then 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
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);
Delay(10);
SetColor(Black);
x:=x+1;
until x>600;
repeat
SetColor(White);
Delay(10);
SetColor(Black);
x:=x-1;
until x<40;

Circle(x,100,10);
Circle(x,100,10);
{ p p p p}
{ }
Circle(x,100,10);
Circle(x,100,10);
{ 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);
{ }
Delay(100);
SetColor(Black); Circle(x,y,3);
until h<0;
SetColor(White); Circle(x,y,3);
{pp p}
ReadLn;
CloseGraph
END.

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

:=320;
:= 50;
:=110;

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

y_yellow :=240;
y_green :=370;

{ 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
until KeyPressed;
{ p, ,
p p:}

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}

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);
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);
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

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

114
VAR s :String;
i :Integer;
BEGIN
s:='p';
for i:=1 to Length(s) div 2 do begin {Length(s) div 2 - p }
Write(s[2*i-1],s[2*i]);
{ p p }
Write('p');
end{for};
{ , :}
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
=
(imya:'Pp';
god_rozd:1984;

{me - }
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
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}
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 }
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
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 .

7.
- 36, 119
(
( 37
)
) 37
*
* 36, 119
.
. 29
/
/ 36
:
:= 32
;
; 29
^
^ 122
+
+ 36, 115, 119
A
Abs...................................................37
Add watch.....................................165
Alt..................................................170
AND.................................................49
Append...........................................146
Arc..................................................150
array..............................................106
Assembler........................................14

Assign.............................................145
B
BackSpace......................................170
Bar..................................................150
Bar3D.............................................150
Basic.................................................14
BEGIN.............................................29
Boolean..........................................111
Byte................................................105
C
C 14
CapsLock.......................................169
Case..................................................51
CD-ROM.........................................25
Char..........................................51, 114
Chr..................................................114
Circle...............................................78
ClearDevice.....................................79
Close..............................................145
CloseGraph......................................76
ClrScr.............................................153
Comp..............................................105
Compile.........................................168
CONST..........................................109
Copy.......................................115, 167
CRT...................................75, 94, 152
Ctr..................................................170
Cut.................................................167
D
Debug.....................................161, 164
Delay................................................69
Delete.....................................115, 170
DirectVideo......................................87
div....................................................36
do...............................................58, 60
DOS................................................153

Double............................................105
downto..............................................60
E
Edit................................................167
Ellipse..............................................79
else...................................................44
END.................................................29
EOF...............................................146
exe..................................................168
Exit...........................................73, 159
Extended........................................105
F
false................................................111
File.................................................159
FillEllipse.......................................150
FloodFill..........................................80
for....................................................60
FORWARD.....................................94
Frac..................................................37
G
GetDate..........................................153
GetImage........................................151
GetMaxX........................................150
GetMaxY........................................150
GetMem.........................................151
GetPixel..........................................150
GetTime.........................................153
GOTO..............................................54
Goto cursor....................................166
GotoXY.........................................153
Graph......................................75, 150
H
Halt...................................................73

I
if 44, 46, 48
ImageSize.......................................151
IMPLEMENTATION..................148
in 119
InitGraph..........................................76
Insert.......................................115, 170
Int.....................................................37
Integer......................................33, 105
INTERFACE................................148
Internet............................................25
K
KeyPressed.................................94, 98
L
LABEL............................................54
Length............................................115
Line..................................................78
LISP.................................................14
Logo.................................................14
LongInt....................................33, 105
M
mod..................................................36
N
new.................................................122
New................................................159
NormWidth......................................79
NoSound..........................................69
NOT.................................................50
O
of 106
Open......................................160, 166
OR....................................................50
ORD...............................................113
Output...........................................164
OutTextXY.....................................152
P
Pascal...............................................14
Paste..............................................167
PC Speaker.....................................24
Pi 37

PieSlice..........................................150
Pos..................................................115
PRED.............................................114
PROCEDURE..................................72
PROGRAM..................................133
Program reset............................163
Prolog...............................................14
PutImage........................................151
PutPixel...........................................77
R
Random......................................37, 82
Randomize......................................83
Read.................................................40
ReadKey.....................................94, 98
ReadLn.....................................40, 146
Real..........................................38, 105
Record...........................................117
Rectangle.........................................77
Repeat..............................................57
Reset(.............................................146
Rewrite...........................................145
Round...............................................37
Run.................................................161
S
Save................................................160
Save as...........................................160
Sector.............................................150
set of...............................................118
SetColor..........................................79
SetDate...........................................153
SetFillStyle......................................80
SetLineStyle.....................................79
SetTextStyle...................................152
SetTime..........................................153
SetUserCharSize............................152
Shift................................................169
ShortInt..........................................105
Single.............................................105
Sound...............................................69
Sqr....................................................37
Sqrt...................................................37
str....................................................152
Str...................................................115
String..............................................115

SUCC.............................................114
T
Text.................................................145
TextBackgrownd............................153
TextColor.......................................153
then...................................................44
ThickWidth......................................79
to 60
TopOff............................................150
TopOn............................................150
Trace into......................................163
true.................................................111
TYPE.............................................110
U
UNIT..............................................148
until..................................................57
User Screen...................................161
V
val...................................................152
Val..................................................115
VAR..................................................33
W
Watch............................................164
While...............................................58
Word...............................................105
Write.................................................28
WriteLn....................................34, 145

.....................37
..............................................120
............................................122
......................................8
..........................................102
......135
........................36
.........36
.......................................14

...............................117
...........................21, 26, 102, 120

.............................................26
...................................................26
.......................................14, 21

...........................159
........................................17
...................105
.....................37
21
.................................23
.....................................23
........................................19
......................................24

66
if...............48
.......134
..........................66
..........134
.22
....................22, 24
......................37
.......................................153

...............147
...............................................17
...............................136

152
...............11, 72
........................................21
..............161
................................135
.........................159
if.......56
62

...................................98
.....................................25
.............127
...........................................75
...................75

.........................................20
..............................................153

......83
.....................107
............................................173
................................137
........................37
.......................................22
..................43
.........................................52
...................................112
122
...........147
...........................................24
......................................8, 19
...................................20, 24
...........................................7
...........................................23
...............................172
......................................174
.......................37

..................................................44

.................................24

..............124
.........................148
......................................21
.....................160
..............................98
............................................79
............................................80
..........................................116
...........................................117
.................102
..................................82
..................................................69
..............................24
......................32
32

49
.............................36

.......................................86
.........................................98
.................................................50
........................35
.............................72
...............................172
..............................148
................................................172
................................................44
106
......................................129

.......................................62
...............41
.....................168
...................162
............................................111
..........................20

76

.........................................172
....................................22
......................................19
...........................102
......................155
25
..............................................8
.................................167
..........................................14
...................10
.................................29
-..............................25
..................................33
.....................................7, 8
...................25
..............................43, 110
.................................167
150
.........................37
.................173
..........................................173
.......................................22, 31
..............................................121
................................................121


.......................23
.................................................14
................135
....................48
Boolean............111
......................174
.....111
.......111
.................................................14
...............................................111
..............126
......................................25

.................................67
...........................................106
..........................................127
........................................106
..............127
.....................................36
...................23
.............................12
..............................................54
...........................131
.............................................86
......................................23
..................................68
................................118
..............................................25
Graph................................150
.................148
.....................................37, 148
CRT...................................152
DOS.................................153
Graph..................................75
.........................................23
.......................................7
.............................................22

50
154

....72. .

..........................................155
..................112
..................106
......................................37
.....................................78
....................................135
........................19
.......................21
.......................24
.........................................14
.........................................73
.........................51
.........................54
................136
.....................34
...............................57
For........................59
Repeat..................57
While....................58
..................................27
..............32
..............40
-...............28
...............21
...................33
...................72
.................109
....................................................21

36
.....................162
..........................................16
Repeat While59
...............................78

.............................................21
..............................................19
.............................................172
................77
-.....................128
-................128
............................................14
......30
........85

16


....................................76
...................32
........................60
.....................................34
...................81
............106
................................167
.......137
, 111
...............113
...........................22
.........19
.....................................................37
.......................................13, 26
..........................................24
..................131
...........................119
.............................126
................................................58
.............................................117
.................................9
.........................52
.........................111

.................................20
,
.................93
..........157
.39

......................................................15
21
...............163, 166
IF........46
" "
29
.......................105
........110
..........................................23
........................................103
......................................12
......85
...............................9
..............11
.....................................8
.............................................14

................70
.......................76
..............................104
.......................38
() 28
.........................................71
........................................73
Write................28
WriteLn...........31
.....................................11
...........................13, 17, 69
..........123
........................................19
................................76
............................114
........................119
.............................................174

.....166
......................114
.......44
148, 149
.........148, 149
.........................73
..............................73
........148, 149
.........................................36
120
...............................172
..................114
........................................21
........................................129
...................................63

. 25
.................................................25
.....................................................14
...............................25, 51, 114
Char..................114
...............51
........................................46
.....138
..........................77
..............................19

............................................22
.............................................36
.............................105
if...48
...........................29
................................102
..........96
.............................37
........................82
...............17
..................135
................................131
.......................47
...............160
................................10
................................104
..........................................122
..........................................105
.......73, 75
............75
.......................................121, 129
..................................80
....................................79
.......................133
............................................115
.................135
.................42
String...................115
..............................................42
......................23
.................133
..134
) ...........104
....................73
....48
........................................65
......................................65
...........................................63
.........................................63
........................59

ASCII..............................102
.......................................152, 153
....................169
........................153

.........................75
........................145
............................72
...................................55
.............................135
.............................110
....110
. 62
..............................................137
44
..............................................29
.............................29
................................................76
......................................93

......................................151
.........................................36
.....................................76
..........22

................21


........................44
..........................22
................22, 23
. 19

94
152
114

...............................................145
...........................145

..........................................172
...........124
.............136
...........124
..............127
..................................136
.............136
........................................125

..................................................79
................................................79
..............................................77

172

...........................37
.................36
...................105
................19
................................................16
.................................................54
...............54

...........................106

.............................105

................................................19
........................................152

.........38
...............136

.............................................78

................75
.............13
............................................137
..............................................34
..........................................33