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

APTVP

DELPHI

DELPHI
7

DELPHI

-
-
2005

681.3.06
32.973.26-018.2
28

28

. ., . .
Delphi . .: -, 2005. 496 : .
ISBN 5-94157-713-3
Delphi, Turbo Pascal 7.0 Object Pascal.
. Delphi,
. , , . .
,
681.3.06
32.973.26-018.2

:

.
.

02429 24.07.00. 23.05.05.


70x100'/. . . . . 39,99.
4000 . 1068
"-", 194354, -, . , 5.
-
No 77.99.02.953..006421.11.04 11.11.2004 .
.

" ""
199034, -, 9 , 12

I S B N 5-94157-713-3

. ., . ., 2005
) , "-", 2005

1.

11

1.1. ?
,
1.2.
1.3. .

11
16
18

2.

23

2.1.
2.2.
2.3.
2.4.
2.5.
2.6.

Turbo Pascal
Turbo Pascal
Turbo Pascal
Turbo Pascal

23
27
30
33
36
37

3.

41

3.1.
3.2.
3.3.
3.4.

;

41
49
54
67
72

4.

75

4.1. //.
4.2. .
4.3. case
4.4. goto

76
87
94
101
105

5.

107

5.1.
5.2.
5.3.

109
114
123
126

6.

127

6.1.
6.2.

127
138
143

7.

145

7.1.
7.2.
7.3.

145
150
154
159

8.

161

8.1. -
8.2. -
8.3.
8.4.

161
168
178
183
192

9.

195

9.1.
9.2.
9.3.

196
203
210
215

10.

217

10.1.
10.2.
10.3.
10.4.

217
221
225
233
242

11. Turbo Pascal

245

12. Delphi

257

12.1. Delphi
12.2. Delphi
12.3.

257
260
276

13. Delphi

279

13.1. Delphi
13.2. Delphi
13.3. ""
13.4. ""

279
284
298
303
314

14. Delphi

315

14.1. ""
14.2. ""

315
322


14.3. ""
14.4. ""

326
335
343

15. Delphi

345

15.1. ""
15.2. " "
15.3. ""
15.4. ""

345
351
365
376
386

16. Delphi

389

16.1. ""
16.2. ""
16.3. " "

389
394
399
414

17. Delphi

415

17.1. " "


17.2. ""

415
421

18. Delphi

429

19.

441

441
444
446
448
450
453
458
461
465
467
469
471

3
4
5
6
7
8
9
10
13
14
15
16

1. Turbo Pascal

475

1.1.
1.2.
1.3.
1.4.

475
477
480
483

2. Delphi

487

File
Edit

487
487


Search
View
Run

488
488
488

3. Delphi

489

491

493


Delphi, Borland.
, , Windows. Delphi Windows- (
Windows-
C++), . , Delphi
RAD- . RAD Rapid Application Development, .
Delphi Object
Pascal, . ,
Delphi, , ,
.
70- XX ,
(16231662). , ,
,
( ), .
, , , ,
- .
. , -

_S

. ,
, ,
.
, , , , . , 1983
, .

.
80-
, .

, . ,
Turbo Pascal, Borland International. (19831992)
Borland , ,
,
, ""
. , , .
Turbo Pascal
MS-DOS, ,
Windows,
, .
,
, Windows.
90- XX Borland ,
MS-DOS
Turbo Pascal, , Windows.
Delphi. ,

Borland
.
Delphi ,
. , , , ,
,
. Delphi ,
.
Delphi, Turbo Pascal, . "" ( integrare , )
, ,
.
Delphi, -. ,
() , , ( )
. ,
, ,
.
,
Delphi . ,

. Cobol
, Fortran , Lisp Prolog . . Delphi ,
. , , , , . ,
Borland Delphi,
,
.

10

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


. , , , .

1.1. ?
, ,
, .
, ,
,
. , ,
, - , .
, , . , , .

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

12

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

13

, ,
.

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

(), .

.

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

14

, .
, . - , , . .
, . , , . 1.1.
,


. 1.1. ,

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

15

.
.
.

n,ai,a2,..

s ai+a 2 +...
...+.,+

. 1.2.

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

16

s, .
. , as .
. , .
, ,
, ,
,

, . , ( , )
, , . .

1.2.
,
, , ,
. , , , , ,
.
, , ( hardware
""), ( software "").
.
, , , , . . ,
, , , .
40- XX ,

Or

17

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

.
,
. , , . . , -, . -,
, , ,
, , .
- .
" ", . . .
. ,
, . . . ( ) , . ,
,
, XXXXI , ,
. , -, . . , , .
,
-

_JS

. formula translation, " ", . .



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

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

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

1.3. .

,
,
.

19

:
1. . ,
, , , , , ,

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

20

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

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

21

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

,
.
,
Turbo Pascal. Turbo "" , ,
.

, .



,
, ? , ,
Turbo Pascal 7.0
, , ,
"" .
, ,
.

2.1. Turbo Pascal


, , ,
, : " ?"
, , , , .

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

Turbo Pascal 7.0.
Turbo Pascal 7.0 ( 2,5 ), , ,
- ,
.
Rip- ( Turbo Pascal).

24_

Rip-
.
, ( Rip , rest in peace, " ").
- . "" , . : , -
.

Turbo Pascal , ,
. , , Turbo Pascal,
http://borlpasc.narod.ru. , Turbo Pascal, ,
, Turbo Pascal
. Turbo
Pascal, .
Turbo Pascal , Windows Internet Explorer. ,
http://borlpasc.narod.ru <Enter>, , . 2.1.

TURBO PASCAL
- ,
, ,
,
.
-
, -
.
, ,

23.10.03
. 2.1. borlpasc.narod.ru

25

,
Turbo Pascal. ,
(. 2.2).

TURBO PASCAL
Turbo Pascal

Turbo Pascal

.< lurDo Pascal! )


# luroo Pascal! )
( )
turbo, tpl ( )
graphs
' chr bai
- pqtgOTg .
...
'" Turbo Pascal Runtime Library - String Handling Unit
(>255 ') PChar
:
File Analyser , .. ( AFO . CDR
..')
' V'STasks 1.01
' ( turbo.tpl)

'

. 2.2. borlpasc.narod.ru,


. :
tp7.zipcwww.borlpasc.narod.ru

, .

. 2.3. tp7.zip

Turbo Pascal,
. ,
Turbo Pascal (. 2.3). tp7.zip
, -

26

. tp7.zip ,
, , . , ,
.
, ,
(. 2.4). , .

.
,
tp7.zip [].
, .
{

: ; ZIP WinRAR

. 2.4. , tp7.zip

, tp7.zip (. 2.5).
. tp7.zip
(1,09 ),
, , 1015 .
, , , , , , (. 2.6).
.

27

: 8% tp/ zip

_J

:
tp7.zip ww

lllllBlllllllIllllllllllilllBIl
:
:

S 57 (: 738 1.09 J
D:\tp74lp7.zip

2.31 /'

" Lj-iar,

'-'' ,] - '

. 2.5. , tp7.zip

I .

""< I

: .

:
tp7.zip wvsiw.boilpascnarod.ru

IIIIIIIIIIIIIIIIIIIIIIIIIIIMIIIIIMIIIIIIIII
;
:

1,09 MB 6 5?
:

D:\tp7\tp7.ap
2,6./;.:.

~ ' j i t .:
I

. [ I I

. 2.6. ,

2.2.
Turbo Pascal
Turbo Pascal
tp7.zip.
-. , Winzip. Winrar
ZIP, ,
.
() 7.

28_

.
turbo.exe ,
, turbo.tpl, , , turbo.tp, ,
turbo.tph, , . , (, BGI,
).
, ,
.
. ,
Turbo Pascal,
,
.
, Turbo Pascal. 7 ,
. prog.
Turbo Pascal MS-DOS, ,
Windows. .
MS-DOS.
7 md prog,

<Enter>.
Norton Commander (
,
MS-DOS). Norton
Commander 7
<F7>.
(prog)
(. 2.7).
Windows.
7
, .
, , , , . (

29

) , -
.
,
(. 2.8).
C:i
SOURCES
TPU

exe
exe
nss
nss

nccleen exe
ncclean ini
ncdd
exe
ncdd
rosg
exe

ansiiubb
ansi2866
arcuiew
bitnap
bug
bungee
clp2dib
dbview

exe
fil
hip
ico
ini
nsg
con
doc

ncnet
ncnet
ncpscrip
ncsf
ncsf
ncsi
ncsi
ncview

bill

tpc
tur
tur
tur
turuo
turbo
turbo

ip
tph
tpl

04

3.01.04

draw2wnf
123view exe drw2unf
4372ansi set evileye
85D2ansi set faces

14:17

set
set
exe
exe
nss
nss
exe
exe

nc
nc
nc
nc
nc
nc
nc
nc

KftTflflOn 15.04.03

exe
msg
hdr
exe
nsg
exe
nsg
nsg

20:1511

. 2.7. Norton Commander

(^

Jl]

Non-system [D:]
Tp7

'
.

' J


<-]:
I Microsoft PowerPoint
*Q Microsoft Excel
@

Microsoft HTML Document 5.0

? j l Microsoft Office Sindei


%J Microsoft Access -
;?1 Office...

WinRAR

I B StudyWorks Document
Q

" "

|~) PROMT Document

Microsoft Data Unk

. 2.8. 7
Windows

30

7
,
. ,

( prog). <Enter>.
prog
.

2.3. Turbo Pascal


,
Turbo Pascal , ,
, .
turbo.exe. , , , , .
Turbo Pascal MS-DOS. , turbo.exe, turbo <Enter>.
Turbo Pascal - Norton Commander.
Norton Commander , turbo.exe,
<Enter>
(. 2.9).
D:i

C:i

BGI

PROG
SOURCES

TPU

turbo

exe
tpu
exe
dsk

turbo
turbo
turbo
turbo
turbop"1

tp
tph
tpl
pif

binobj
graph

tpc

turbo.exe
D:\TP7>

ITTP

402474

5.10.92

C:\HC =

draw2unf
123vieu exe dru2unf
4372ansi set evileye
8502ansi set faces
8632ansi set fish
8652ansi set flip
D662ansi set ico2dib
ansi2437 set mouse
ansi2850 set nsp2dib
ansi2863 set nc
ansi2865 set nc
ansi2866 set nc
arcview exe nc
bitmap
exe nc
bug
nss nc
bungee
nss nc
clp2dib exe nc_exit
dbuieu
exe nc_exit
8:02

exe
exe
nss
nss
nss
nss
exe
nss

exe

cfg
exe

fil

hip
ico
ini
msg
com
doc

ifl

ncclean
ncclean
ncdd
ncdd
ncedit
ncedit
ncff
ncff
nclabel
cna in
ncnet
ncnet
ncpscrip
ncsf
ncsf
ncsi
ncsi
ncvieu

10< 15.04.03
; 9rji

. 2.9. Turbo Pascal


Norton Commander

exe
ini
exe
msg
exe
msg
hip
msg
exe
exe
exe
msg
Mr
exe
msg
exe
msg
msg

20:15J|

i 1,

' ' _I

31

Turbo Pascal Windows. Windows,


:
, turbo.exe, ;
Turbo Pascal ""
, , (. 2.10);
Windows turbo.exe ,
.

Jniernet Explorer

&

_'

Windtiw$35_step$

-)

[Jj

^Hardware

J3

Interne)

ll

MiciosoltOffici!

.'.'

'^

Windows Update

fig MS-DOS
>
'
.,-.','
-- Microsoft Office .
Turbo Pascal

I Miwosoft Office

55
\jb

Microsoft QuickBASIC

')

WinRAR

13

Windows Commander

|^

12)

'J3

.j

*])

0>1..
^

User...

Keyboard
Acrobat Reader 5.0
MathSoftApps

Miciosod Visual Basic 6.0

i S i Borland DelpN 6

>

Lrr)

InterBase

.*

Electron books

L^

Macromedia

i^r) ABBYY FineReader

Q
...

_rj

Virtua1CDv4

^UniarTutM

Norton Commander ;

ij)

'*j

'.''"

HyperMelhod Publisher 3000

l|i) PROMT 38 ;

:
1 0 1 I ^MicrosoftWoid S i Slow '

'

. 2.10. Turbo Pascal


Windows

Windows
, ,
. , turbo.exe. (
MS-DOS, Windows)

32

, - ,

( turbo.exe) .
: Tuibo Pascal

3URB0

J Ulpwpr j J ] |
(Turbo Pascal

^1
*. or ' 5.: p-srS'TTtl
1
MS-DOS. "".
...

...

. 2.11. - turbo.exe,


,
. .
: , , , , , .
(. 2.11).
. .
,
turbo.exe (. 2.12).
MS-DOS, Turbo Pascal, Windows.
, .
,
. (
) . -

33

, .
I
PIF-: D:\TP7\TURBOP~1.PIF
" Windows
R

MS-DOS

zi
OK

2.12. turbo.exe

2.4. Turbo Pascal



.
: ,
(. 2.13).

.
(. . ), <F10>. ( , ). < > < >.
<Enter> , . .
. ,
. <Enter>
. . , . , 2 3. 1068

34
Pascal

I- lie Search

Run Conpilc

Uebuj

"S*ve

F3 Open I I U i l ? ia

. 2.13.

, .
,
, . Turbo Pascal . , , :
File ;
Edit ;
Search ;
Run ;
Compile ;
Debug ( );
Tools
(, );
Options ;
Window , ;
Help .
. 2.14 Turbo Pascal
( File). ,
: , , -

35

, , , , . , Turbo Pascal File | Exit.


,
: File,
<Enter>, .
,
, Turbo Pascal.
f H Turbo Pascal
I Edit Search

Hun Compile

Debug

Tools

ilptions

flindou

Help

Tlpen;.
Saw
Sauc a s . . .
Sane a l l
Change d i r . . .
Print
Printer setup...
BOS s h e l l
Exit
HU+X

ill

. 2.14.

, .
( ).
, , . , , . ,
, .
<F1>, <F3>
<Alt>+<F10>. .

36

2.5.
,
, .

. . , , , ., , , , . , ,
.
:
Z. ,
, . .
;
0 9;
. , .
:

+ . * / =< >
[ ] , ( ) : ;

@ { } $ #


<= >= := (* *) ( )
,
, . :
asm array begin case const constructor destructor div
do downto else end exports file for function goto
if
implementation in inherited inline interface
label
library mod nil . not object of or packed procedure
program record repeat set shl shr string then to
type unit until uses var while with xor

. , - , .

37


( , ) , .

2.6.

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

.
, ,
. . , ,
. , . ,

38

.
.
, ,
. .
,
, :
program ;
uses ;
label ;
const ;
type ;
var ;
function ;
G procedure ;
begin ( );
end .
. ,
begin end
. .
:
program _

,
, , , . , ;
.
, ,
. ,
, . ,
.
uses, "",
.

39

uses . Turbo Pascal : crt


, Graph .
crt .
.
. const, var.
, , .

:
function, procedure,
label, type.
, . ,
, .
begin.
.
, . ,
,
, .
.
end,
.



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

3.1.
, , . File | New ( New File
<Enter>).
,
(. 3.1).
,
.
turbo.tp. turbo.tp, , . -

42

. Options, Save TURBO.TP (. 3.2).


, , .
NonameOO.pas.
NonameOl.pas, Noname02.pas . .
\ Turbo Pascal
tdit

Search ttun uonpil

ools

Upturns

Window Help

. .1. Turbo Pascal

rile

tdit

search ttun Laniule

Uebua

tools
Compiler...
Memory sizes
Linker...
Debugger...
Directories.
Tools...

. 3.2.

43

, ,
, .
. : " ".
(. 3.3, 3.1).
! 3.1.
program pervprog;
begin
writeln (' ')
end.

I^Tuibo Pascal

ToolsOptions
MUIJMM

Window Help

program pervprog;
begin
uritelnCMoa nporparna ')
end.

. 3.3.

, ,
. . <Enter>.
.
,
, <Backspace>, , . , , <Delete>.
:

44_

( program, begin end) , .


. , . . .
,
program. ( pervprog). , . . ,
.
begin ().
. , writein
, .
,
( ).
.
( ), .
writein ,
, . end (),
.
, . (), ,
, . .
-, Noname ( ""). Noname, . - ,
Noname, , . , , ,
, Summa2.pas.
.
, , :
* =+ [];:,.<>/?

45

Turbo Pascal
MS-DOS, :
( MS-DOS) 8 ( 3 ,
). , ,
11 .
" 8+3". , Turbo Pascal,
pas.

File | Save as ( | ).
, .
, . , . ,
<Enter> Save as, . 3.4.
\ Turbo Pascal
oolsOptionsWindow

PROG13
PRBCU
PR0G15
PROGU
PR0G17
PR0G18

elp

tnter directory path and tile mas


. .4.

.
, . .
- .
, , , . .

46

, ,
, ( ),

, . , .
( ), Cancel
( ) Help ( ). .
,
( ).
.
, , . , , ,
.
<> . (< >, <
>, < >, < >) .
, , ,
<>
<Enter>,
. , , prog. ,
.
( ),
.. ( )
<Enter> .
, , . ( )
<Enter> .
,
.

47

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

, , (), . ,
pervprog prog, 7, D:, : TP7\prog\pervprog.pas.
, , File | Save. ,
.
, , . . ,
Compile (), , .
. ,
.
MS-DOS Windows. ,
, . Run .
.
,
<Ctrl>+<F9>.
, (
, , ),
. ,
,
, " ":
Error 5: Syntax error

48


end, :
Error 10: Unexpected end of file

: "" , . .
.
Output () Debug. Debug
"" ( " "),
,
, . Output
(. 3.5). 2 . 1
.
.
Irtrt Turbo Pascal
TTIeEditSearchRunCompile
^^M^iiniMa!MT ,

Debug

loolsOptionsWindow

Help

ij, j.iiT Mja;iiij;riTaij.T'ii^

r
t<<
M
l
program peruprog;
begin
uriteln (' ')
end.

= [ ] = = = = = =
Output i
Turbo Pascal Uersion 7.0 Copyright Cc) 1983,92 Borland International

I r i Help

Ti-**- Scroll

2=[]=

Flu Menu

. .5.

,
, User screen ( ) Debug <Alt>+<F5>.
, Output, .
,
- .

49

writein
write.
writein, write , , , . write writein . : "
".
write:
write('') ;
write(' ' ) ;
write('');

writein:
writein('');
writein(' ' ) ;
writein('');

,
:

, write writein , . , ,
, . ,
.

3.2.

. .
, . -

50

crt, . , Turbo
Pascal .
system. . ,
Crt , ,
Uses Crt.
Textcoior. Textcoior . Turbo Pascal 16 . :
Black ;

DarkGray -;

Blue ;

LightBlue ;

Green ;

LightGreen -;

Cyan ;

LightCyan -;

Red ;

LightRed -;

Magenta ;

LightMagenta -;

Brown ;

Yellow ;

LightGray -;

white .

TextBackground.
Textcoior,
8 :
Black

Red Blue

Magenta

Green

Brown

Cyan LightGray

TextColor TextBackground

, . .
:
1 ;

9 ;

2 ;

10 -;

2 - ;

11 -;

3 ;

12 -;

4 ;

13 -;

5 ;

14 ;

6 ;

15 ;

7 -;

128 .

8 -;

51

. , , . . -
. 128 .
:
Textcolor(lightgreen) ;
- .
Textcolor(10);

Textcolor(10+128) ;
- .
, -
(. 3.6):



Turbo Pascal 7.
, , , . , . cirScr.
, Crt. TextBackground .
Textcolor ,
writein. 3.2
.
I 3.2.
program democolor;
Uses Crt;
begin
CirScr;
TextBackground(LightGray) ;
TextColor(Red);
writein(' ' ) ;
TextColor(Green);
writein(' ' ) ;

52

3
TextColor(Blue);
writeln('

');

TextColor(Yellow);
writeln('Turbo

Pascal 7.0

' ) ;

end.

.
, , ,
. ,
. , . ,
,

, .
Turbo Pascal
program denocolor;
Uses Crt;
begin
ClrScr;
TextBacfcgi-ound(LightGray);
TextColor(Bed);
writeln('3Ta ' ) ;
TextCo lor(Green);
uritelnC' ' ) ;
TextColor(Blue);
uritelnC' ');
TextColoKVellou);
uritelnCTurbo Pascal 7.0 ' ) ;
end.

H e l p F 2 Sane

Local menu

. 3.6. , C r t (), ()

53

. 3.6 , (. 3.7).
.
, .
3, 128,
. 3.3 .
Pascal
program blinki;
Uses Crt;
begin
ClrScr;

TextColor(3+128);
writeln(' , ');
untelnC' ...');
uritelnCHe , ,');
uritelnCD , ');
readln

. 3.7. , (), ()

\ 3.3.
program blinki;
Uses Crt;

54

begin
ClrScr;
TextColor(3+128);
writeln(' , ');
writelnf' ...');
writeln('He , ,');
writeln('A , ');
readln
end.

.
, ,
, . , . 3.7, . ,
, , .
crt ,
.

3.3.

, , . ,
, .
, . ,
(. 3.8, 3.4). , - (, ), .
() .
3.4.
program suirana;
var
,,:integer;

55

begin
:=5;
:=10;
:=+;
writeln(c)
end.

HTuibo Pascal
le fcdit Search

Kun Compile

Debuglools

OptionsWindow Help

program surma;
uar
a,b,c: integer;
begin
a:=5;
:=10:
c:=a+b;
writeln(c)
end.

. .8. , (), ()

,
Crt. ,
, . . "" ( ), . ,

56

crt,
cirScr,
" ", .
, var ( variable ). , ,
. ,
. - , :
Error 3: Unknown identifier

, ,
var.
, integer (. .
). , : , .

, . .
.
:
_:=;

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

57

=+5 ;
:=+5 . ,
, 5. ,
3,
8.

5 10.
+, . . . , writein.
, writein , . -, , ,
(
). -,
, . :
writein();

, 15.
( ) , . .
,
,
(. 3.9).
3.5.
?

'

| 3.5.
program summa;
Uses Crt;
var
a,b,c:integer;
begin
ClrScr;
writein (' 2 ');
writein (' Enter');
readln(a) ;
readln(b);

.........j

58

3
c:=a+b;
writeln(' 2 *,);
readln

end.

lm Tuibo Pascal
H i e tdit Search

Kun . Compile

Debug

lonls

Uptions

Window I

program surma;
Uses C r t ;

a,b,:integer;
begin
ClrScr;
writeln (' 2 ');
writeln (' Enter');
readln(a);
readln(b);
:=*;
uritelnCcyma 2 ',>;
readln
end.

. 3.9. () ()


readln. readln
writeln: readln , . write
writeln . readln,
:
readln();
readln(b);


. ,

59

, . . . ,
. , <Enter>. , , . . .
. .
, , . . "" , .
. , ,
. , :
writeln (' 2 ');
writeln (' Enter');

,
, . ,
, . . .
2 .
writeln , . , , ,
,
, . ,
"" readin.
,
<Enter>, . .
, .
Debug User screen
Output, , .

. , , (. 3.1).

60
3.1.

" = (* ))

div

mod

, .
, : (
*, : /). ,
, .
, ,
, , . ,
,
, . 3.1.
, ,
, ,
. ,
, . div mod .
div mod:
91 div 8 11;
91 mod 8 .
, . ""
, , .
, ,
. . , .

61

, . , , , . . .
, , . , :
5 + 3* (7+2) - 40 d i v 4

, , 9. : 3 ( 27) ( 10). 5 27 10. 22.


, : writeln
, ,
.
writeln , . , . , -
20 30, writeln +:
:=20;
:=30;
writeln(+);


,
, . . 50.
. , .
, , , (. 3.10).
:
1 = 1024 ;
1 = 1024 ;
1 = 8 .
4 : mb ,
kb , by , b i t .
:

62

,
integer.
-32 768 32 767.
longint, -2 147 483 648
2 147 483 647. 3.6 .
Pascal
Ij file
Search

Kim Uonp l le

Debug

lools

(Iptio

Window

Help

program memory;
Uses Crt;
var
mb,kb,by,bit:longint;
begin
ClrScr;
uriteln (' ');
readln(mb);
kb:=102<tmb; by:-1024*kb; bit:=8*by;
w r i t e l n f ' , k b > ' ');
writelnCby,' ' ) ;
u n t e l n C b i t , ' ');
read In
end.

J3 Turbo Pascal
J2

'

nahifiiw 32/68
35!>1>432

. 3.10. , (),
(6)

3.6.
program memory;
Uses Crt;
var
irib,kb,by,bit:longint;

63

begin
ClrScr;
writeln (' 1);
readln(mb);
kb:=1024*mb;
by:=1024*kb;
bit:=8*by;
writeln(' ' , k b , ' ');
writeln(by,' ' ) ;
w r i t e l n ( b i t , ' ');
readln
end.

, readln, , writeln.
writeln , .
. , , , , ,
.
, ,
div mod. , ( 3.7, . 3.11).
, . ,
, .
1000, 500, 100 50 . . . ( , , 50.) 1000.

1000 . 500
500 .
100 . ,
100 50
50 .
, , ,
4750 , 1000
:
4750 div 1000 = 4; 4750 mod 1000 = 750

64

, 1000
4, 750 .
500:
750 div 500 = 1; 750 mod 500 = 250
, 1 500 ,
, 50- 100- , 250 . , ,
50- 100- .
Tuibo Pascal
program bankonat;
Uses Crt;

sun,ki000,k50D,k100,kSO.vspora:integer;
begin
ClrScr;
uritelnC ' cymy, 50');
readln(sun);
k100u:=sun div 1000;
vspon:=sun nod 1000;
k500:=uspon div 500;
ospom:=uspon nod 500;
k100:-vspon div 100;
vspon:=vspon nod 100;
k50:=vspon div 50;
writelnC' 1000 - ',k1000);
uritelnC' 500 - ',k50D);
writelnC' no 100 - ',k100);
writeln(' 50 - ',k5fl);
readln
end.

21:8

'

*Pi Turbo Pascal


l! re c y m t j ,
1000 - 3
500 - D
10D pyeaeri -
50 > - 1

. 3.11. "" () (6)

\ 3.7. ""
program bankomat;
Uses Crt;

65

var
sum,klOOO,k500,klOO,k50,vspom:integer;
begin
ClrScr;
writeln(' , 50');
readln(sum);
kl000:=sum div 1000;
vspom: =sum mod 1000;
k500:=vspom div 500;
vspom: =vspom mod 500;
kl00:=vspom div 100;
vspom:=vspom mod 100;
k50:=vspom div 50;
writeln(' 1000 - ',kl000);
writeln(' 500 - ',500);
writeln(' 100 - ',100);
writeln(' 50 - ',50);
readln
end.

: sum
, kiooo 1000 ;
500 500 , klOO
100 , 50 50 , vspom
, , .
kiooo, ksoo, kioo k50, .
vspom
.
1000, 500 , , 100.
.
, , .
,
.
.
.
. , ,
.
, . 3.12. . 1068

66

"" , ,
, .
, ,
, (* *) .
,
. . .
3.8 , .
Pascal
rile

tdit

Search

Kun

Compile

Debug

loo I s

Upturns

Window

program bankonat;
Uses C r t ;
uar
sun,k1000,k5D0,k1DO,k50,wspon:integer;
begin
ClrScr; { )
writeln(' cymy, SO');
readln(sum);f }
k1000:=sum dig 1000; { 10S0 )
vspom:=suM nod 1000;
k500:=vspon div 500; ( 50 )
uspom:=uspon nod 50(1;
k1D0:=vspon div 100; { 100 )
spon:=spon nod 100;
k50:=ospon diu 50;
{ 50 )
writeln(' 1000 - ',k100D) ; {)
writelnC' 500 - ',kbUU);
{)
wiitelnC' 100 - ' , 1 0 0 ) ;
{ )
w r i t e l n ( ' 50 - ' , 5 0 ) ;
{}
readln
end.
21:7
ke Hlt+FlO Local menu
Save 1-3 Upen

Pascal
c y m y , fjU
>
IKMOT no 1000 pyertei\
1BO fed iKHOT no ( J 0 0 IKHOT 111 - iKHtiT no SO *> -

-
0
3
1

. 3.12. "" () ()

3.8. ""
program bankomat;
Uses Crt;

67

var
sum,klOOO,k500,klOO,k50,vspom:integer;
begin
ClrScr; { }
writeln(' , 50');
readln(sum);{ }
kl000:=sum div 1000; ( 1000 }
vspom:=sum mod 1000;
k500:=vspom div 500; { 500 }
vspom:=vspom mod 500;
kl00:=vspom div 100; { 100 }
vspom :=vspom mod 100;
k50:=vspom div 50;
{ 50 }
writeln(' 1000 - ',1000); {}
writeln(' 500 - *,500);
{}
writeln(' 100 - ',100);
{ }
writeln(' 50 - ',50);
{}
readln
end.

3.4.
, , Turbo Pascal, , .
,
(. . ),
real ().

.
,
, . ,
10,23 10.23.
.

- , , a n . , 1 10.
.
,
mEn,

68

10. . 125.73
(
) 1.2573000000+02, ..
1.2573-102, 0.00441 4.4100000000-03, ..
4.41 10~3. , , , , . .
,
.
.

, , (. 3.13). ,
, . . 1 , w , h
v .
readln.
w, writeln.

. 3.9 .
I 3.9.
I,....,......,..,.,

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

....,..,.. ,

...,....!

program paral;
Uses Crt;
var l,w,h,v: real;
begin
ClrScr;
writeln(' ');
readln (1) ;
writeln(' ');
readln (w);
writeln(' ');
readln (h);
v:=l*w*h;
writeln (' ',v);
readln
end.

, 4.2, 2.5 1.8, : 1.8900000000+01.

69

, .
. ,
. .
. . , , ,
. ,
. , ,
t, , 8 , 3 , 1 , 4 ,
:
writeln(t:8:3);

, (
) , , "" , , , .
, :
writeln

(' 1 ,

v:6:2)

. . 6 ,
3 , 1 2 .
:
18.90

. . ,
(. 3.13).
3.9 , , , ,
. ,
, ,
. , :
.
, , , ,

70

3
Tuibo Pascal
program paral;
Uses Crt;
war l,w,h,u: real;
begin
CIrScr;
uritelrK ' ');
readln (1);
writelnC' ')
readln (w);
writelnC' ');
readln Ch);
u:=l*w*h;
writeln (' *,v:6:2);
readln

. 3.13. fa) ()

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

71

, . .
,
. . 5 4. 1.25, . . .
. 25 5,
5.0 ( 5, ). , ,
1, ,
, , .
, .
,
. : . ,
, . , . . .
(), : trunc, round, chr ord.
.
, ,
Turbo Pascal. , ,
, .
.
-,
-
. -, , .
Open
File. ,
,
Save as.
, (

72

) . Open
(. 3.14).

. 3.14.


1. , -
:

:
1)
2)
3)
2. , , * (). ,
*, . .
, .
3. ,
, .

73_

.
. ,
.
4. , . .
5. ,
. ,
. 1
( )
( )
.


,
.
,
. , .
,
,
, .
.
,
.
, , . , , . 6 :
< ;
> ;
= ;
<= ;
>= ;
.
3 ,
<, > , . . -

76

,
.
, , .
if.

4.1. if
if :
if
then !
else 2;

if, then else , , . :


, , if.
( , ),
, ,
( ) , else.
, ,
.
if ,
. (. 4.1), .
( ), > (
). ,
, ( ,
), , ( , ).
,
. 4.2. readin
.
if > writein, then, , else.

77

, if.. .then.. .else


, , . .
, (
). 4.1 .

. 4.1.

! 4.1.
program maxim;
Uses Crt;
var a,b:integer;
begin
ClrScr;

78

writeln (' ');


readln(a) ;
writeln(' ');
readln(b);
if a>b
then writeln(a,' ')
else writeln(b,' 1 ) ;
readln
end.

SfTuibo Pascal

I-lit

Bun Compile

Uebug

loals

program maxim;
Uses Crt;
war a,b:integer;
begin
ClrScr;
uriteln <' ');
readln(a);
writeln(' ');
readln(b);
if a>b
then writelnCa,' ')
else uritelnCb,' ');
readln
end.

Help

F2 Sae

FFTipen

.;

. 4.2. () (6)

if -, . , ,
. 4.3 ,
. " ", " -

79

". writein , , . i.
1961.
, writein , i ,
. 4.2
.

Lr lie

tdit

Search

Run Compile Debug

lools

Options

windowHelp

program flight;
Uses Crt;
war i: integer;
begin
Clrscr;
writein (' ?');
writein (' "Enter"');
readln(i);
if i = W 1
then writein (' ')
else uritelnCBbi ');
readln;
end.

. 4.3. - () ()

[ 4.2.
program flight;
Uses Crt;
var i:integer;

80

begin
Clrscr;
writeln (' ?');
writeln (' "Enter"');
readln(i);
if i-1961
then writeln (' 1)
else writeln(' ');
readln;
end.

, ,
, .
.
:
if then ;

. , if, , , then, ,
,
, .
, :
. ,
, 4.3.
I 4.3.

program ;
Uses Crt;
var a,b, ,max,min:integer;
begin
ClrScr;
writeln(' ');
readln(a);
writeln(' ');
readln(b);
writeln(' ');

81


readln();
:=;
if b>max then max:=b;
if O m a x then max:=c;
min:=a;
if b<min then min:=b;
if c<min then min:=c;
writeln(' ',max);
writeln('

',min);

readln
end.

S T u i b o Pascal
Edit Search

EFile

Bun Compile

Debug

lools

Options

Window

Help

program ;
Uses Grt;
var a,b,c,nax,nin:integer;
begin
ClrScr;
uritelnC' ');
readln(a);
uritelnC' ');
readlnCb);
uritelnC' ');
readlnCc);
if > then nax:=b;
if c>nax then nax:=c;
nin:=a;
if b<nin then nin:=b;
if c<nin then nin:=c;
uritelnC'
uritelnC'
readln
end.
23:1

Turbo Pascal

211


96


. 4.4. ()
(6)

(. 4.4) readln , , .
, , max. max , , .

82_

max
if. , max, max , .
max, ,
. max .

.
, .
max, max :
. max, max .

max , . max
writeln .

(min).

, -, . 4.3. ,

(. 4.5). 3 ,
. ,
. ,
, 5 .
1 . (
3 ) .
.
. 5. , . writeln.
, . readln i. .
if. "" , ,

83

, . . 1 . , , then,
, . . , .
, . . , . 4.4 .
Pascal
lie

Edit

Search

nun Compile ilebuy Tools


" SFM 'JTTi

Dpi ions

Window

Help

program space;
Uses C r t ;
war i,n:integer;
begin
ClrScr;
n:=S;
wi i t e l n C B !) ');
readln(i);
if i<>195? then n:=n-1;
writelnC'B ');
readln(i);
if i<>1961 then n:=n-1 ;
writelnC'B ' ) ;
readlnC i ) ;
if i<>1969 then n:=n-1;
uriteln(' ' , ) ;

reedIn
end.

*|*g Tuibo Pascal



1961
II

\969
B<iui*i 3d 34 S

. 4.5. () ()

! 4.4.
program space;
Uses Crt;
var i,n:integer;
begin
ClrScr;
n:=5;

84

writeln(' ');
readln(i);
if i<>1957 then n:=n-l;
writeln(' ');
readln(i);
if i<>1961 then n:=n-l;
writeln(' ');
readln(i);
if i<>1969 then n:=n-l;
writeln(' ' , ) ;
readln
end.

, -
. , . , , , ,
then else.
,
begin end. begin end,
,
, .
: ,
, ( ,
) . , , .
, , . begin end . end (
), . . end
, . ,
:
if then
begin
_1; _2; ... _
end

85

else

begin
_1; _2; ... _
end;

, .
, .
.

, ,
1000 ,
. ,
. ,
,
, .
1000 ,
, .
, ,
: sum ,
skidka , sumsk
. .
.
sum 1000, , then. , 4 .

sum 0.03. skidka.
. sumsk. .
.
, . , , , , , .
, 1000 , , else.
writein,

86

4
Tuibo Pascal
- lie tdit SearcIT
Compile Debug lools Options
ni
--^l'iifMi:;-!-!
progran magazm;
Uses Crt;
sun,sunsk,skidka?rea1;
begin
ClrScr;
writelnC' cynriy ');
readln(sun);
if sun>1fl00 then
begin
5kidka:=sum*0.03;
sunsk:=sun-skidka;
uritelnC'Cyma ',skidka:7:2);
writeln(' ',sunsk:7:2)
end
else
titriteln(' ');
readln
end.

H e l p F 2 Save

F3 pen

ConpiIf

Window

Help

Local

. 4.6. , (),
(6, )

,
. 4.5 .
4.5. ,
program magazin;
Uses Crt;
var sum, sumsk,skidka:real;

87

begin
ClrScr;
writeln(' ') ;
readln(sum);
if sum>1000 then
begin
skidka:=sum*0.03;
sumsk:=sum-skidka;
writeln(' ',skidka:7:2);
writeln(' ',sumsk:7:2)
end
else
writeln(' ');
readln
end.

. 4.6
(. 4.6, 1000 . 4.6,
1000).

4.2. .

,
, : ""
( ) "" (
). - "" ""
true false. ,
(true false), .
XIX ,
.
boolean.
:
var logic:boolean;

,
,
. , , :
logic:=>=15;

88

. . logic
>=15. ,
logic true.
false. ,
,
.
,
.
writeln .
true false :
logic:=true;


. ,
. , , , . 3 , z flag,
. , , , ( ). , ,
,
. var, ,
.
flag false.
3 ,
. ,
, ,
, , , . , flag true. , ,
. , , flag true. ,
flag , . . false.

89

, flag. flag ( if) : true,


, then,
false, , else.

, ,
. 4.6 .
I 4.6. , ,
i
program pozit;
Uses Crt;
var x,y,z:integer; flag:boolean;
begin
ClrScr;
flag:=false;
writeln(' ');
readln(x) ;
if x>0 then flag:=true;
writeln(' ');
readln();
if y>0 then flag:=true;
writeln(' 1 );
readln(z);
if z>0 then flag:=true;
if flag then writeln(' ')
else writeln(' ');
readln
end.

. 4.7 .

,
.
, . . , true false.
4 : not (
), and ( ), or ( -

90

), ( ). ,
. . , , ,
. . , .
not, .
Tuibo Pascal
File Edit
U
. ri-g

Search

Bun

Compile

Debug

Tools

- -ijiiiin;n

Options
.

Window

Help

_4[

program pozit;
Uses Crt;
war x,jf,z: integer; flag:boolean;
begin
ClrScr;

lUf.-iaHf,

writelnC' ');
readlnCx);
if x>0 then flag: true;
writelnC' ');
readlnCy);
if y>0 then flag:=truc;
writelnC' ');
readlnCz);
if z>0 then flag:=true;
if flag then writelnC' ')
else writelnC'Bce ');
readln
end.

. 4.7. , , (),
(6, )

, , .
not, . . . -

91

and. or .
, , , , , ,
.
,
, ,
.
. . 4.1 4.2
.
4.1.

not (X)

false

true

true

false

. 4.1 , not,
, .
, . 4.2,
, and true ,
Y, ( ) true. false. or
true, ( )
true. or false , false. true, . (
, false true),
false.
4.2.
X

X and Y

X or Y

X Y

false

false

false

false

false

false

true

false

true

true

true

false

false

true

true

true

true

true

true

false

92

, . , ,
5 20, . . 5
20, :
(>=5) and (a<=20)

,
.
: , .
, .
, . , ,
, .
if, ,
. , ( 10)
( 99). , and.
, then.
. cl 2. cl 10. 2
10.
sum writein .
10, 99 (. . if ) , else, . .
. 4.7 .

93

lie

edit

search

nun Compile

Debug

Tools

Options

program cifrsum;
Uses Crt;
x,c1,c2,sun:integer;
begin
ClrScr;
writelnf' ');
readln() ;
if (x>-10> and ix<=99) then
begin
e1:=n nod ID;
c2:=x div 10;
sun:=d+c2;
uritelnCCynna ',sun);
end
else
uriteln('Bu ');
readln
end.

. 4.8. ()
(, )

4.7. ,
program cifrsum;
Uses Crt;
var

x,cl,c2,sum:integer;

begin
ClrScr;

94

writeln(' ');
readln(x);
if (x>=10) and (<=99) then
begin
cl:=x mod 10;
2:= div 10;
sum:=cl+c2;
writeln(' ',sum);
end
else
writeln(' ');
readln
end.

. 4.8 .
, , ( " ").

4.3. case
,
,
.
if.
if, , . ., ,
.
. . , , ,
, , .
,
, . case.
case :
case of
_ 1: _1;
_2: _2;

95

_: _;
e l s e _+1
end;

case, of, e l s e . case


of " ".
. - .
-. , ,
. , , .
- case , ,
else. , if case else
. (else )
. case end, .
,
case!
case k of
1: x:=x+5;
2: x:=x+10;
3: x:=x+20;
e l s e x:=0
end;

- . , 1 ( - read
readln, ), 5,
, 2, 10,
3, 20, - , . -

96

. case .
, case, ,
.
. -
, . readin writein
.
, . , 1
, 2 . .
readin , -. case. (, , )
writein.
writein , , . (. .
, ), ,
. ,
.
, .
, , writein , - .
4.8 .
! 4.8. ,
program kalkulat;
Uses Crt;
var a,b,x:integer; d:real;
begin
ClrScr;
writein(' ');
readin(a);


writeln(' ');
readln(b);
writeln(' , ');
writeln('( )');
writeln ('1 - , 2 - , 3 - , 4 - '
readln() ;
case of
1: writelnfa,'+',b,'=',a+b);
2: writeln(a,'-',b,'=',a-b);
3: writeln(a,'*',b,'=',a*b);
4: begin d:=a/b; writeln(a,'/',b,'=',d:7:3) end
end;
readln
end.

. 4.9.
Tuibo Pascal
program kalkulat;
Uses Crt;
war a,b,x:integer; d:real;
begin
ClrScr;
writelnC ');
readln(a);
uritelnC' ');
readln(b);
writelnC' , ');
writelnC'( )');
uriteln '1 - , 1 - , 3 - , 4
readln(x);
case x of
1: writeln(a,'+',b,'=',a+b);
2: uriteln(a,'-',b,"=',a-b);
3: uriteln(a,'',b,'=',a*b);
4: begin '.-/; writelnCa,'/' ,b,'-' ,d: 7:3) end

. 4.9. - () ()
4 . 1068

97

98_

case .
-. , , ,
-
. , ,
, , .
, .
. case, , .
, - :
case n of:
3,5,7: :=*;
10..20: :=**;
30..40: :=***;
e l s e y:=x
end;

, 3, 5 7,
. 10 20 (10, 11, 12 . . 20 ),
, .
30 40, , .
, ,
.
case : ,
, ,
.

. ,
, ,
. 4.9
.
4.9. ,

program month;
Uses Crt;


var m: integer;
begin
ClrScr;
writeln(' ');
readln(m);
case m of
1,2,12:
begin
textcolor(LightGray);
writeln(' ')
end;
3,4,5:
begin
textcolor(Green);
writeln(' ')
end;
6,7,8:
begin
textcolor(Red);
writeln(' ')
end;
9,10,11:
begin
textcolor(Yellow) ;
writeln(' ')
end;
e l s e writeln(' ')
end;
readln
end.


, -. .
1, 2 12 writeln,
, . Turbo Pascal , . .
( ,
) ,
. -

100

( , ). ,
. ,
(,
). (. 4.10).
Tuibo Pascal
program month;
Uses Crt;
n:integer;
begin
Clr-Scr;
writelnC' ');
readln(n);
case n of
1,2,12: writelnC' ');
3,4,5: begin textcolor(Green); writelnC' ') end;
6,7,8: begin textcolor(Red); writelnC' ') end;
9,10,11: begin textcoIorCVellou); uritelnC' ') end;
else writelnC' ')
end;
read In
end.

. 4.10. , (),
(, )

101_

4.4. goto
, , ( ),
.
,
- . , , ,
, ,
, .
, , .
,
,
(, ,
). , , .
, ,
, , . .
:
goto _;

goto , "
", __ , label.
,
, . . : metkal, metka2 . .
, , :
me t ka: ;

. . , , , .
, .
.
,
,

102

.
.
:
l a b e l __;

l a b e l , "", _
, .
, . ,
, ,
,
,
. , , "", .
, , goto ,
,
. .
, , , , . .
, .
, ,
.
, ,
,
, . , ,
. ,
, goto, ,
.
, .
( 4.10),
" " ,
else. ( ), . ,
, ,

103

, . , , .
: ,
else. else
, ,
begin end. .
, , . .
. ,
.
( ),
10.
end. end,
case .
, , , 10. , , . 10 label. ,
, 0 13, "" ,
.
4.10 .
4.10.

program monthl;
Uses Crt;
label 10;
var m:integer;
begin
ClrScr;
10: writeln(' ');
readln(m);
case m of
1,2,12:
begin
textcolor(LightGray);

104

writeln(' ')
end;
3,4,5:
begin
textcolor(Green);
writeln(' ')
end;
6,7,8:
begin
textcolor(Red) ;
writeln(' ')
end;
9,10,11:
begin
textcolor(Yellow);
writeln('
end
else
begin

')

writeln(' 1);
goto 10
end
end;
readln
end.

. 4.11
:
.
,
. .
, , . . .
,
( , ).
.

105


* Pascal
F i l e Edit Search

Run Compile Debug

Fools

Options

Window Help

progran month;
Uses Crt;
label 10;
var n:integer;
begin
ClrScr;
10: wntelnC' ');
readlnCn);
case n of
1,2,12: writelnCflpxuna ');
3,4,5: begin textcolor(Creen); uriteln( " ') end;
6,7,8: begin textcolor(Red); uriteln(' ") end;
9,10,11: begin textcolor(Vellou); writelnC' ') end;
else
begin
uriteln(' ');
goto 10
end
end;
readln
end.
1
=
21:10 r

h H Tuibo Pascal
BtteAMte Hunep neomd
U

. 4.11. ()
()


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

106

, . ,
( ),
(. . ).
4. , , . , : 1 ,
2 (
), 3
( , 15).
.


,
,
.
. , , .
: , .
1 50 .
, (1, 2, 3 . .
50), .
,
.
:
kg:=c*100;
writeln(c,kg);

, , a kg , , , , kg
.
,
:
50 ,
,
readln.

108

,
kg 50.
2, kg 100. 50, a kg
5000. , ,
" " .
, , - ,

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

50. ,
, , 51, .
, .

109

3 .
.
( for.. .to).
( while).
( repeat. . .until).
,
.
, (
for... to while , repeat.. .until
) . , for...to.
repeat.. .until ( ,
), while (
,
). .

5.1.

:
for _:=_ to _ do
_;

:
for, to do (for "", to
"", do ", ").
_ , .
. - , .
- ,
, .
.
_, _ .
.
, .

110

_ ,
. .
,
do.
- integer,
.
,
.
,
, :
for c:=l to 50 do
begin
kg:=c*100;
writeln(c, kg)
end;

( ). 1.
, , . . kg, 50, 1 50 .
kg , 2, 2 100 , ,
kg 50 5000.
,
50. , , 50-1+1 , . . 50 . , ,
,
5 . ,
, ,
100 .
. 5.1
. ( , ). "".
. ( "")
, .
,
. ,

111

, , ,
. , (,
).

:=1,50

kg:=c*100

c,kg

. 5.1.

for . for
:
for _:=_ downto _ do
_;

, , ,
.
for , , , . 1
, , . 1 1,609 . ,

112

, .
, - . 5.1 .
! 5.1. , , ,
!
program milkm;
Uses Crt;
var mile,n:integer; km: real;
begin
ClrScr;
writeln(' ');
readln(n);
writeln(' ');
writeln('
');
for mile:=l to n do
begin
km:=mile*1.609;
writeln (mile: 3, '
\km:7:3)
end;
readln
end.

. ,
-, mile, ,
. -, , , . , km,
.
readln .
. mile 1, . , 2 . , mile (
) km ( ). , ,
writeln, .
, (
mile)

113

( 3), ( km)

( 7 3). , . =10 , . 5.2.
Tuibo Pascal
program nilkn;
Uses Crt;
war nile.n:integer; kn: real;
begin
ClrScr;
writelnC' ');
readlnCn);
writelnC' ');
writelnC'
');
for nile:=1 to n do
begin
kn:=nile1.609;
writeln(nile:3,'
',kr>:7:3)
end;
readln
end.

Open

Tuibo Pascal

10

1
2
3
4
5
6
1
8
9

1.60?
3.218
4.827
6.436
8.045
5.654
11.263
12.872
14.481

. 5.2. ()
(6)

5.2.
:
repeat
_
until ;

repeat until , repeat "", until


" ". : , . , , until. ,
, , , . . , , , until, . ( "" "").
, , ,
. , ,
.
: .
. , , .
: , , (,
).
. .
.
: rost
;
, ,
, . .
, , - , ; sum
; s r e d (
, . . ).

115

sum , . .
,
. repeat .
,
, ,
, .
( ) rost.
,
sum , . ,
sum (
,
, , ). sum , . .
.
,
.
. .
, . ,
, ( ) . sred ,
. 5.2 .
5.2.
program s r r o s t ;
Uses Crt;
var rost,n,sum:integer;
sred:real;
begin
ClrScr;
sum:=0;
n:=0;
repeat
writeln(" ' ) ;
writeln('flnH ');
readln(rost);

116

sum:=sum+rost;
n:=n+l
until rost=0;
sred:=sum/(n-1);
writeln('

',sred:7:2,' ')-

readln
end.

T mho Pascal
I File Edit Search

Run Compile

Debug

Tool

Options

Window

Help

^ it'll J'TlTrt.!'] 4 J^i) AI^'I'Til^t M'fil*J^wgiw^TI !"

progrdn srrost;
uses Crt;
var rost,n,sun:integer;
sredzreal;
begin
ClrScr;
sun:=Dj; n:=0;
repeat
uriteln(' en');
writelnC' ');
readln(rost);
sun:=4iintrost;
n:=n+1
until rost=U;
sred:=sum/(n-1);
writelnt' ',sred:7:2,' en');
readln
end.

I F1 Help

F2 5ae

F3 Open

AH+F Conpile

FJ Make

3 Turbo Pascal
|1!1
jjjnsi


*

fiins
170


183


175
re

|

1/4.20

. 5.3. () (6)

117

, ,
. ,
,
.
. 1 20. . 5 . ,
. ,
5 , , , . , , , ,
.
,
, .
, , ,
, .
, . ,
, , .

Randomize;

, ,
.
random()

. random , 0 -1. random


. ,
,
random(10);

0, 1,2, ..., 9, . .
0, , . -

118

, random (. .
1, 2, ..., 9), , :
Randomize;
writeln(random(9)+1);

.
1 (0+1), 9 (8+1).
, ,
5.3.
f -'---

I 5.3.
I
program igra;
Uses Crt;
var
x,y,n:integer;
begin
ClrScr;
Randomize;
n:=l; x:=random(19)+l;
Textcolor(cyan) ;
writeln(' ( 1 20)');
writeln(' ( 5 )');
repeat
Textcolor(green);
writeln(n,' ' ) ;
writeln(' Enter');
readln(y);
n:=n+l
until (x=y) or (n>5);
if x=y then
begin
Textcolor(lightred);
writeln(' ')
end
else
begin
Textcolor(lightblue);


writeln
end;
readln
end.

(' .

119
',)

. random ,
. , , ,
. .

. , , ,
, .
.
.
.
, . readln .
, ,
( )
.
, ,
, .
, -, ,
, . . .
.
, . ( ) , 6 (5+1). , 5, . . >5.
or ( ), . . , , .
, -
, . if,
- -

120

.
,
. ,
then.
, , , .
,
else.
,
"" Textcoior.
,
. , , - , .
:
(. 5.4, ), (. 5.4, ).

. 4
, ,
, . .
.
, , . 4.3.
.
, ,
,
1 4.

. ,
, , , , -, .
writeln(' , ');
writeln('( )');
writeln ( - , 2 - , 3 - , 4 - ');
readln(x)

121


Tuibo Pascal

"" *

JL

0 1 1

<s m

tnler

V
intbyi i r e
1 nonUTt

yr- 10 ttcero tt.K. 'J )

2
? *

KOIIDMIJ

Enter

3 *
<* KfSdBH.J

h 1


11
5 ! a

14

Enter

1 !4(l<BtiJ Cuter

Enter

3 11

(ton iHcsa 3

H Turbo Pascal
i ***^n ut-fi ( 1 /)
& ( S )
1
^^ Ft

!1

?
I** 1;*i I e
3
1 itfiu t, A ft t fi
g

. 5.4. " "

,
, :
(x=l)

or

(x=2) or

(x=3) or

(x=4)

:
repeat
writeln(' , ');
writeln('( )');
writeln ('1 - , 2 - , 3 - , 4 - ');
readln(x)
until (x=l) or (x=2) or (x=3) or (x=4);

122

5
Turbo Pascal
- ucpitue
&

3S
,
( ^)
1 - , 2 - 1<, 3 - , -
5

,
( )
1 - , 2 - , 3 - ,, -
/
,
( | >|)
1 - , 7 - , 3 - ;{;, -

. 5.5. -

,
5 7, . 5.4.
! 5.4. -
|
program kalkl;
Uses Crt;
var a,b,x:integer; d:real;
begin
ClrScr;
writeln(' ');
readln(a);
writeln(' ');
readln(b);
repeat
writeln(' , ');
writeln('( )');
writeln ( - , 2 - , 3 - , 4 - ');
readln()
until (x=l) or (x=2) or (x=3) or (x=4);
case of
1: writeln(a,'+',b,'=',a+b);
2: writeln(a,'-',b,'=',a-b);

123

3: w r i t e l n ( a , ' * ' , b , ' = ' , a * b ) ;


4: begin d:=a/b; writelnfa,V,b,'=',d:7:3) end
end;
readln
end.

. 5.5 -
.

5.3.
while :
while do
_;

while d o , while "", d o ", ".


: , while, , . , , .
, . . , ,
. .
,
. , .
while
. ,
( ), . ,
. ,
.
( ,
) . , 2. ,
.
, 2.

124

,

. , ( , ). .

, readin.
,
.
d. d , d
, .
, , . .
mod d = .
2. d
2.
. , d
. d , , . . . , mod d = 0. , d
, .
-, d. -,
, d.
div d. ,
, .
,
then. d ,
, else. d ,
. 5.5
.
\ 5.5.
program razl;
Uses Crt;
var ,d:integer;

125

begin
Clrscr;
writeln('
1 );
readln();
writeln(' ',,' :');
d:=2; .
while d<=c do
if mod d = 0
then begin write (' ',d); c:=c div d end
else d:=d+l;
readln
end.

Tuibo Pascal

Search

Hun Compile

llebuq

lools Uplions

Window

Help

program razl;
Uses Crt;
var c,d:integer;
begin
Clrscr;
writeln(' ');
readln(c);
writelnC' ',<:,' MOIIIO :');
d:=2;
while d<=c do
if nod d = 0
then
begin
write (' \ d ) ;
c:=c div d
end
else d: d+1;
readln
end.

neau

. 5.6. () ()


, .

126

,
.
, . . 5.6.


1. ,
, 175 . , , , 25 . .
2. 5
. , ,
, ,
,
. .
3. , .
.

, , . ., . .

, ,
64 . ,

, . ,
, ,
.
4. , ,
, , .


, ( . 3.1 , . . , , ). , ,
,
, (, ,
). . char
string, .

6.1.
, ,
. , . , , ,
.
, , .
, ,
. . , , , . , ,
,

128

. , , .
,
, .
, .
ASCII.
ASCII American Standart Code for Information Interchange, "
".
. ( ), 0 9,
, .
. , "N" 78, "" 110 ( ). "6" 54, 32, 44 . . ,
,
, , ,
.
.
128 . IBM-PC .
ASCII ,
128 .
, , . , ,
( ).
, ,
<Alt>. , , . , , (V ).
, ,
, 256 . ,

129

, ,
0 9 "" "F", 10 15. . 6.1
, ASCII,
.
32 20
33 21
34 22

35
36
3?
38
39
40
41
42

23
24
25
26
27
28
29
2

43 2B

!
"
tt
$
Si
&
"

)
*

*
44 2C ,
45 20 46 2 .

411 30
49 31
511 32

51 3J
5? 34
53 35
54 36
55 37
56 38
57 39
58
59 3
6U 3C
fit3D
62 3E
63 3F

U - ^ -41
1
65 41
2
66 42
67 43
It
68 44
"5. 69 45
6
70 46
7
71 47
8
72 48
9
73 49
74 4ft
.. '; 75 4B
< 76 4C
77 40
>
78 4E
9
79 4F

in

146 92 ,
147
148 94
149 9G X
150 96 U
151 97
153
154
155 9
156 9

158 9

162 2

164 4
165 5
166 6
167 7
168 8
169 9

0
E
F

ii

I
J

I,
M
N
U

178 2 j<
179
180 4
161 BS i
182
183 7 ,
184
185

I
186

170
171
172
173 AD
174 0
175

II

18/ i
188
189

190

BE

191 BF

To"To"
81 51
82 52
83 53
84 54
85 55
86 56
87 57
88 58
89 59
90 5
91 50
92 5C
93 50
94 5E
95 5f

193
194
195
196

1
2

197 5
198 6
199 7

U
U

:v
.

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

61)
61 a
62 b
63
64 d
65
66 f
67
68 h
69 i
6A j
68
6C I
60 M
6E n
6F 0

114
115
116
117
118
119
120
121
122
12 J
124
125
126
127

72
73
74
75
/6
77
78
79
7A
78
7
7B
7E
7F

II

W
X

t
I

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143

8U
81
82
83
84
85
86
87
88
89
8A

it
1"

8F

II

213 DS
214 06
21S 07

"1"
X

226

227
228 4
229 5
230 6
2.11 7
232 8
233 9 , III
234
235

23/
238
239 >

n
ffi
3

8C
80
8E 0

F.1 1 F f

209
210 02
211 03
212 04

200 8
216 08
201 9 ' 217 9
202 1 218
203
219
204
220
20S
00
' ' 221
206

222 BE
207 CF . 223 BF

112 70
113 71

242 F2
243

248 F8
249 F9

244 (4 i
245 5 i
246 6
247 F7
250 FA

251 FB S
252 FC

253 FB
254 FE
255 FF

. 6.1. ASCII
( , )

, , , .
.
, ,
, . :
. . , .
5 . 1068

130

,
. :
var

_:char;

char , , char
character,
"".
, :
var i,n: integer;
d: real;
sim,bukv: char;

(i ),
(d), (sim bukv).
- ,
. :
sim: = 'in' ;

, sim "". :
cfr: = '7\-

, cf r "7" ( 7, ).
.
,
. , :
( true), . . ""
171, "" 173. :
(false), . . "" 170,
"" 226. . , .

chr ord, -

131

. , , , , .
chr
. :
chr()
. , chr (33) ' ! ' , chr (233) '' . .
, .
ASCII 0 255. ,
0 31 . ,
32, 255. , ,
, .
.
, , if. ,
, or
. ,
, , .
, .
. . i
,
.
. ,
chr,
i. ,
.
, write. .

132

j 6.1. , :
program symbols;
Uses Crt;
label 10;
var i, a, b:integer;
begin
ClrScr;
10: writeln(' ( 32 255)');
readln(a);
writeln(' ( 32 255)');
readln(b);
if (a<32) or (b<32) or (a>255) or (b>255) or (a>b) then
begin
writeln(' ');
goto 10
end;
writeln(' ',,' ',)
writeln(' ');
for i:=a to b do
write(chr(i),' ' ) ;
readln
end.

, 176, 215, . 6.2.



. , , , , , , .
ord chr.
, .
:
ord('s')

s , . , ,

.
1
ord (''), ' ) . . ""
166, "" 228.

133

Tuibo Pascal
tdit Search

Kile

Run Compile

Debug

lools

Options

Window

Help

progran symbols;
Uses Crt;
label 10;
war i,d,b:integer;
begin
ClrScr;
10: writeln(' ( 32 255)');
readln(a);
writeln(' ( 32 255)');
readln(b);
if (<32) or (b<32) or (a>255> or (b>255) or (a>b) then
begin
u n t e l n C B u ');
goto 10
end;
virit.eln( ' *,*,' * , b ) ;
writeln(' ');
for i'.-a to b do
write(chr(i),' ' ) ;
readln
end.
21:1

==-

*tS Turbo Pascal


* ( 32 255)
176
( 32 255)
215
176 215

i ill 1 i \\ 1 1 il II il J ~] L (. _ + 1= I * if * *

'

t - * 4

f '-i

. 6.2. , ASCII (a),


()

, . ,
, .
case...of
.
, . case.. .of, .

134

case letter of
1
n': writeln('!');
1
': writeln('!');
' ' : writeln(' !');
end;

,
letter, . "",
"!", "", "!", "", " !". , l e t t e r char.
. ,
.
: , .

: "" , ""
, "" .
,
s, :

2 \

,
:

I I"
m n
6.2 ,
.
! 6.2. ,
! ,

i
program charcase;
uses crt;

135

label 10;
var i, k,m,n,d:integer; rezireal; ch,p:char;
begin
10: ClrScr;
writeln(' ');
readln(m);
readln(n);
writeln(' ');
writeln('a - ');
writeln(' - ');
writeln(' - ');
writeln(' ');
readln(ch);
case ch of
'a': begin
rez:=(m+n)/2;
writeln(' ',rez:6:2)
end;
'6': begin
d:=l;
if m<n
then k:=m
else k:=n;
for i:=l to k do
if (m mod i =0) and (n mod i =0)
then d:=i;
writeln(' ',d)
end;
'': begin
rez:=2/(l/m+l/n);
writeln(' ',rez:7:3)
end;
end;
writeln(' (/)');
readln(p);
if -' 1
then goto 10
end.
. readln .
writeln ,

136

,
.
ch
readin.
ch - case...of.
, -.
,
rez, .

d. ,
d, . , ,
. if .
. ,
.

. , .
i. , i m , . .,
i. and. , i . i , , . ,
d
, . . ,
.

, .
"" "". (""),
, 10.
, . , -

137

. . 6.3

.
Turbo Pascal

6

;
-
-
-
?

<|
7.00
(/)


6
8
;
-
-
-

8


6.857
(/)

P i Tuibo Pascal

.
- ^
-
-

2
(/)

. 6.3. c h a r c a s e
(), ()
()

138

6.2.
, , , , , . . .
.
string.
:
var _: string[];

string , . . , .
, :
var i:integer;
:real
stroka:string[25] ;

, i
stroka,
25 . , , , , .
, 255 .
:
var stroka:string;

, ( , , ,
writein), . , stroka
"_" :
stroka:= '_';

, .
- . , siovol " ", siovo2 "", :
slovo:=slovol+slovo2;

slovo "Turbo Pascal".


.

139_

, :
fraza:=slovo

+ " 7 . 0 " ;

fraza "Turbo
Pascal 7.0".
, , . 6.3
.
! 6.3. ,
program privet;
uses c r t ;
var x : s t r i n g [ 4 0 ] ;
begin
ClrScr;
writeln(' ');
readln(x);
writeln;
writeln(', ' , , ' ! ' ) ;
writeln(' !');
writeln(' . ');
readln
end.

.
writeln . readln
. 40, . .
, , 40 . "" writeln
,
.
. writeln . "", . . .
, . . .
. -

140

writein .
. 6.4. .
Tuibo Pascal
I F i l e FdTE Search
1^-

program privet;
uses crt;
war x:string[40];
begin
ClrScr;

Run

FonpTTe Debug loo Is


-i li \*aii*

Options

Window

Help
'

uritelnCKaK ');
readln(x);
writein;

uritelnC', '>,'|');
writelnC' Ban !');
writelnC' . ');
readln
end.

Ja
Tuibo Pascal

I, !
Ban !
.

. 6.4. , ,
(), (6)

, length. - , : , ( ,
). length, stroka , 14, 25, ,
. . " " 14 .

141

, ,
, ,
. , ( ) stroka[5],
"", .

, . ""
. , i 10, stroka[i],
"" "", .
,
ASCII. 6.4 , .
6.4. , ,

program naborkod;
Uses Crt;
var i,dl,n:integer;
si:string[50];
begin
Clrscr;
writeln (' ') ;
readln(sl);
writeln(' :');
dl:=length(sl);
for i : = l to dl do
begin
n:=ord(sl[i]);
write(n,' ')
end;
readln
end.


, 50. -

142

, readin, si. length


. di.
, ,
. i , dl. ,

, , dl.
3 Turbo Pascal
File fidit Search

RunCompile

Debug

Tools

Uptions

Window

Help

program naborkod;
Uses Crt;
uar i,dl,n:integer;
sl:string[50];
begin
Clrscr;
uriteln (' ');
readln(sl);
uritelnt' :");
dl:=length(sl);
for i:=1 to dl do
begin
n:-ord(sl[i]);
writeCn,' ')
end;
readin
end.

3 Turbo Pascal


|> 84&< :
14i] m 169 3? 170 Mh 17J 1?5 236 2.18 226 16

. 6.5. ()
(6)

143

, , . , -, . , , . . , , i.
ord, .
.
.
, , . .
" ",
, . 6.5.
13 , ,
,
32.


1. , ,
,
, ,
.
2. , .
, . , " Apple" 4 , 3 .
, .
3. ,
.
4. , .
: - (, 10).
, . , , ,
.



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

7.1.
. ,
.
, . . ,
.
,
. ,
. ,
-, :
var _: a r r a y [ a . . b ] of _;

var, array of . Array "", of


"", .

146

.
var a: array[1..2O] of integer;
,
20 , .

var st: array[l.,10] of string[15];


st 10 , 15 .
,
. - , . ,
: [], , .
. 7.1 .
7.1.
|
program month;
Uses Crt;
var m:array[1..31] of r e a l ;
i,v:integer;
min,max,x:real;
begin
ClrScr;
writeln(' '); readln(v);
writeln(' 1 '); readln(m[l]);
min:=m[1]; max:=m [ 1 ] ;
for i:=2 t o v do
begin
writeln{' ' , i , ' ');
readln(x); m[i]:=x;
if m[i]<min then min:=m[i];
if m[i]>max then max:=m[i]
end;
writeln(' ',max:7:2);
writeln(' ',min:7:2);
readln
end.

147


. 1, 31 ( , ). ,
, , v.
. i 2 v, . . . ( , .)
, i- .
, 31,
.
.

( ), . min max.
,
( ).
( ) .
, min,
( ) ,
. min,
. . max.
min max
, writein.
. -, , . , , ,
. . -, . , , .
, , , . , ,
- , 12- ,
.

148
Turbo Pascal
Bun

Compile

Debug

lools

Upturns

Windom

Help

program month;
Uses Crt;
war n:array[1. .31] of real;
i,v:integer;
nin,nax,x:real;
begin
ClrScr;
writelnC' '); readlnCv);
writelnC' 1 '); readlnCn[1]);
nin:~n[1]; nax:=n[1];
for i:=2 to v do
begin
writelnC' ',i,' ');
readlnCx); n[i]:-x;
if m[i]<nin then nin:-n[i];
if m[i]>nax then nax:=n[i]
end;
writelnC' ',max:7:2);
writelnC' ',nin:7:2);
readln
end.
Open

I PI Turbo Pascal

5>.3

10.7

1.5

12.0

8 .

lonpile

Local menu

20
21
sa 22
23
2**

25
.6
26
11.2
27
7.8
28
6.0
29
8.4
30
11.4

!<*?

14.S0
1.20

. 7.1. ()
(6)

. ,
XX
XXI . ,
1948 .
.
,
12- .
. 12 -

149

. , 1948 2055 ( ),
, . . .
,
,
if. .
.
, or, "". , , .
12- , .
. 1947
( ,
).
,
. 12.
. , . ,
. 7.2
.
! 7.2.
program kalend;
Uses Crt;
const v o s t : a r r a y [ 1 . . 1 2 ] of s t r i n g =('','','','',
'','','','','','','','');
var , : i n t e g e r ;
begin
Clrscr;
writeln(' ( 1948 2055)');
readln ();
if
(y<1948)or(y>2055)
then writeln(' ')
else
begin
:=(-1947) mod 12
writeln (,' ');
writeln (' ',vost[k],' ');
end;

150

readln;
end.

Pascal
Edit Search Ifun Unpile Debug lools Options fTindow Kelp
]
---'!'

- -i
! :
- - imt
rogran kalend;
ses Crt;
const uost.:array[1..12] of strin<) = ('','','','",
'','.', '','','','','*,'');
,: integer;
begin
Clrscr;
uritelnf' ( 1948 2055)');
readln ();
if (<1(>2055)
then writelnCBu ')
else
begin
k:=(y-1947) nod 12
writeln (,' ');
uriteln (' ',ost[k],* ');
end;
readln;
end.

Pascal
( 1? 2)
12002
|?00?

. 7.2. , (),
()

7.2.

, , , ,
.
.

151

8
:
var _: a r r a y [ . . , . . d ] of _;


; e n d
.
,
-a+i c-d+i .
:
var t a b l : array [ 1 . . 9 . . 9 ]

of integer;

, 9
9 .

arrsum, : 4x5.
. : ,
,
, ,
. 7.3 .
{ 7.3. ,
|
:
program arrsum;
Uses Crt;
var
f : a r r a y [ 1 . . 4 , 1 . . 5 ] of r e a l ; x : a r r a y [ l . . 5 ] of r e a l ;
begin
Clrscr;
for i : = 1 t o 4 do
for j : = 1 to 5 do
begin
writeln(' ' , j , ' ' , i , ' ');
readln(f[i,j])
end;
writeln(' ');
for i : = l t o 4 do
begin
for j : = l t o 5 do write ( f [ i , j ] : 7 : 2 , ' ' ) ;

i,j:integer;

s:real;

152

writeln
end;
writeln(' ');
for j:= 1 to 5 do
begin
s:=0;
for i:=l to 4 do
s:=s+f[i,j];
x[j] :=s;
write(x[j]:7:2,' ')
end;
readln
end.

arrsum . f,
. , , 4 5 .
,
,
.
5 f.
f , .
.
.
5 ( , , , ). j 1 5. ,
readln, writeln
,
. i 4 ( , ).
, f
,
. , ,
, . j . ,
-

153

( ), . 7 ,
4 , 1 2 .
i, , .

.
,
, 5 (, , ). i , . s.
,
.
s .

. ,

. ,
, .
. 7.3 .
Tuibo Pascal
2 3
3.8
3 3
5.1
4 3
6.7
5 3
7.8
1 4
2.1
2 4
4.8
3 4
.8
4 4
9
5 4
7.4

.70
7.3
2.80
0.40
.7
8.1
3.40
4.70
2.?0
3.80
5.10
6.7
2.10
4.8
8.80
9.

1S.40
24.00
2.30
20.8
. 7.3. ,

154

7.3.
, , , . . .
.
. , ,
. . , . .
.
.
,
. . , . . .
. , ,
.
.

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

155

, 7.4.
""'

.........

..

.......

I 7.4.
program vybsort;
Uses Crt;
var
m:array[l..10] of integer; i,k,max,n:integer;
begin
ClrScr;
for i : = l t o 10 do
begin
writeln(' '/if' ');
readln(m[i])
end;
for n:=10 downto 2 do
begin
max:=m [ 1 ] ;
k:=l;
for i:=2 t o n do
begin
if m[i]>max then
begin
max:=m[i];
k:=i
end;
end;
m[k] :=m[n] ;
m[n]:=max;
end;
writeln;
for i:=l to 10 do write(m[i],' ' ) ;
readln
end.

, .
.
. , , , .
.
, -

156


, ( ),
.
.
10, 2, . . , .
.
max, ,
. . . , 1.

, .
i,
. 2
. , ,
. max, max , m[i], ,
i- . ,
,
.
, ,
. m[n],
. ,
.
i
.
. 7.4.
. ( -

157

)
: ,
. , . .
, , . . , , , ,
,
. ,
.
Turbo Pascal
1

2
!1
3
95
4
291
5
118
6
675
7

8
969
9
83
1(1
365
11 3< 41 83 95 118 291 365 675 969

. 7.4.


, .
. ( ) , , ,
.
7.5.
program obmsort;
Uses Crt;
var m:array[1..10]
i,n,t:integer;

of

integer;

158

begin
ClrScr;
for i : = l to 10 do
begin
writeln('

',i, ' ');

readln(m [i]) ;
end;
for n:=10 downto 2 do
if m[i]<m[i-l] then
begin
t:=m[i];

i-l]:=t
end;
writeln;
writeln(' :');
for i:=l to 10 do
write(m[i],'

');

readln
end.

ISuTuibo

916

1024

65

14

?1

378

41

65

Pascal
1
2
3
4
5
6
7
8
9
10

:
8 14 < 65 378 1 6?S ?16 1024

. 7.5.

, 7.5. , , 10 . i. , -

159

.
,
10 ( ) 2 ( ). , , .
. i .
2. , . . .
i- ,
i-l. , ,
.
, , then. t. t . . ,
, t.
. . 7.5.

, .
,
, .
, ,
.


1. , ,
( 20), .
.
2. , , 1 50.
, -

160

.
.
3. , ,
( 20), .

.
4. , , , ,
. ,
.
,
.


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

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

, .
,
. .
6 3. 1068

162

(
length, ord char, ) :
abs(x) ,
;
arctan(x) ,
;
(,,1) , . 1. 1
;
cos (x) , ;
delete (x,n,l) ,
. 1;
() , . . ;
int (x) .
;
1() (. .
);
pi , ;
round (x) ;
sin(x) , ;
sqr(x) ,
;
sqrt (x) ;
trunc(x) . .
2 + + = 0.
8.1.

program qwur;
Uses Crt;
var a,b,c,d,xl,x2:real;

163

begin
Clrscr;
writeln(' - ,,');
readln(a);
readln(b);
readln();
d:=sqr(b)-4*a*c;
if d<0 then writeln(' ')
else
begin
xl:=(-b+sqrt(d))/(2*a);
x2:=(-b-sqrt(d))/(2*a);
writeln(' ');
writeln(xl:6:2,' ', x2:6:2)
end;
readln
end.

sqr
. , . , . , , sqrt.
2, 7 3 , . 8.1.
( ),
. (. . begin).
-, . . ,
. :
;
, ;
begin

end;

164

8
W% Turbo Pascal

I d i e Ldit

U H I

Search

ITuii

Compile

Uebuq

HUM,

lools

Upturns

Window

progran qwadrur;
Uses Crt;
var d,b,c,d>x1,x2:redl;
begin
Clrscr;
uriteln(' - a,b,c');
readln(a);
readln(b);
readlnCc);
d:=sqr(b)-Hac;
if d<0 then writelnC' ')
else
begin
x1:=(-b+sqrt(d))/<2*a);
x2:=(-b-sqrtCd))/(2a);
writeln(' ');
uriteln(x1:6:2,' ', 2:6:2)
end;
readln
end.

Help

Compil
Turbo Pascal
- a,b,c

3

II.) 3.UU

. 8.1. () ()

:
function _ ( ): ;

function , "". , . , , . , ,
, ,
.
.
:
function beta (x,:integer; z:real):real;

165

beta, 3 :
, z , .
, ,
, . ,
begin end. , .
( ) . ,
,
.
, , , . .
, . , , , .
, .
,
d:=beta(3,4,7.5)

beta, 3, 4 7.5
, z.

( ) . ,
,
.
,
,
. .
:

\(- )\
\, \ ( - )\ , ( -). 1 .

166

I 8.2. , no/n
program sochet;
Uses Crt;
var n,m:integer;
a,b,c,d:longint;
function faktor(k:integer):longint;
var i : i n t e g e r ;
r:longint;
begin
r:=l;
for i : = l to do
r:=r*i;
faktor:=r;
end;
begin
Clrscr;
writeln (' 2 ., ');
writeln (' ');
writeln (' ');
readln(n,m);
a:=faktor(n);
b:=faktor(m);
c:=faktor(n-m);
d:=a div (b*c);
writeln(' ' , , ' no ',m, ' ' , d ) ;
readln;
end.

, 8.2.
,
faktor.
, ,
.
.
, . . . . . , . .
, . , ,
. ,
.

167

,
. ,
, . , ,
, . , i , . ,
i .
Pascal
|| I- l i e bo1 i t Search

Bun

Compile

Debug

loo Is

Up t ion*

Window

Help ~

program sochet;
Uses Crt;
n,n: int; a,b,c,d:longmt;
function
faktorCk:integer):Iongint;
var izinteger;
r:longint;
begin
r:=1;
for i:=1 to k do
r:=ri;
faktor:=r;
end;
begin
Clrscr;
writeln (' 2 , ');
writeln (' ');
readln(n,n);
a:=faktor(n); b: faktor(n); c:=faktor(n-n);
d:=a diu ( b * c ) ;
writeln(' ',,' *,,' ' , d ) ;
readln;
end.

HUES
I ,
)*; >
;* i !> 3

10

. 8.2. n no m () (6)

.
, , 1.
. , i ( i 1 ).
,
faktor , .

168


(, 10 3 628 800),
longint.
,

faktor. ,
, .

faktor . ,
d . writein . . 8.2
, 5, , 3.

8.2. -
,
,
. , . ,
, . ClrScr, TextColor TextBackground.
read, readin, write
writein.
:
Delay (i) i ( );
Exit .
( Exit Turbo Pascal,
);
GotoXY (, ) , ;
Halt .
;
str(x,s) s;
Vai(s,x,n) s, ,
. -

169_

, .
, . ,
, .

" ".
" ",
10 1, . . ,
, "".
i 8.3. " "
program obrcourlt;
Uses Crt;
var i:integer;
begin
ClrScr;
for i:=10 downto 1 do
begin
GotoXY(l,l);
write(i) ;
Delay(20000)s
ClrScr
end;
GotoXY(l,l);
writeln('');
Delay(20000);
ClrScr;
readln
end.

, 8.3 . 8.3.

. .
, GotoXY
, . ,
,
, Delay.
ClrScr,
. "".

170
Turbo Pascal
Search

Kun

Compile

Debug Tools

Option

Window

Help

program obrcount;
Uses Crt;
war i:integer;
begin
ClrScr;
for i:=1D downto 1 do
begin

CotoKVd.1);
urite(i);
Delay(2000D);
ClrScr
end;
CotoXVd.D;
writelnC ');
DelayC20000);
ClrScr;
readln
end.

. 8.3. " " () (6)

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

171

:
;
;
begin

end;

.
:
procedure _ { );

procedure , ,
,
. .
. ,
. , , ,
, .

,
. .
. var, . var
, -. - , , .
-
, . , -,
(
). ,
,
.
:
procedure vspomog(a,b:integer; var c,d:real);

vspomog , , , , d ,
-, d .

172


, . ,
.
.
, . .

,
, end ,
, . . .

4 , 8.4.
8.4.
4
!..,..

..;.

;.

........

.;...,;

....:.:......

program four;
Uses Crt;
var a,b, , d,l,m,big,lit,mini,maxl,min2,max2:integer;
procedure minmax(xl,x2:integer; var min,max:integer);
begin
if xl>x2
then
begin
max:=xl;
min:=x2 end
else
begin
max:=x2;
min:=xl end
end;
begin
ClrScr;
writeln (' 1 ');
readln(a);
writeln (' 2 ');
readln(b);
writeln (' ');
readln(c);
writeln (' 4 ');
readln(d);
minmax(a,b,mini,maxl);

173

minmax(c,d,min2,raax2) ;
minmax(mini,min2,lit,1);
minmax(maxl,max2,m,big);
writeln(' - ' , b i g , ' ; - ' , l i t ) ;
readln
end.

.
. minmax, .
. minmax . .
minmax 2 - xi
2, , 2 - min max, . -
min, max.
minmax
4 .
d . mini maxi ( )
min2 2 ( ).
2 ,
2 , l i t . 1, , , , . .

.
big, m
1 .
writein.
. 8.4 65, 111, 678 d 215.
,
, . -

174

8
Turbo Pascal
1

65
2

111
3
678
'*

215

HdKCMndntvHoe ~ 678; - 65

. 8.4.

, . ,

. (
),
. , 31 ,
.
( , , ). 8.5
, .
I 8.5. ,
program tomorrow;
Uses Crt;
label 100;
var
d,m:integer; otv:string[3];
procedure next(kol:integer;var mes,n:integer);
begin
if n>kol then
begin
writeln(' . ');
Delay(60000);
Halt
end;

175

if (n=31) and (mes=12) then


begin
n:=l;
mes:=l;
exit
end;
if n=kol then
begin
n:l;
mes:=mes+l
end
else
n:=n+l;
end;
begin
ClrScr;
writeln(' ');
readln(d);
writeln(' ');
readln(m);
case m of
l,3,5,7,8,10,12:next(31,m,d);
4,6,9,ll:next(30,m,d);
2: begin
100: writeln(' ? (/)');
readln(otv);
if (otvo'flA 1 ) and (otvO'HET 1 ) then
begin
writeln(' . ");
goto 100;
end
else
i f otv='flA' then next(29,m,d)
e l s e next(28,m,d) end;
end;
writeln(' ' , d , ' . ' , m ) ;
readln
end.
.
next.
next - koi
, - mes . -

176

next mes . , . :
. () . (mes) ;
.
, ;
, . .
, . . 1 ;
(,
, 32).
,
.
next.
if
(. .
, ).
, , Halt.
,
Delay.
, 31 . mes
1 1, next exit,
.
if .
(n<koi),
, a mes . 1 ( ), mes . , mes , .

177

IfiSSTuibo Pascal

31

12
1.1

Pascal

16

17.7

Turbo Pascal


31

10
1.11

. 8.5. , ,
(), (6) 31 ()

,
-, . .
, one-

178

case, - .
, 1, 3, 5, 7, 8, 10, 12 (. . , , , , ,
, ), 31. , 4, 6, 9, 11 (. .
, , , ), 30.
( = 2), . . ,
, , . 29, 28.
,
, , . if.
"" "" - ,

, .
next koi case
, mes m d, .
-
. ( ), .
. 8.5 ( ,
31 ).

8.3.
,
, .
( , ) .
, - . (
recurrence, ""
""), .

179

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

().
.
, , (1). 8.6.
1 8.6. ,
program stepint;
Uses Crt;
var x,st:real; :integer;
function rek(a:real;k:integer):real;
begin
if k-1
then rek:=a
else rek:=rek(a,k-1)*a
end;
begin
ClrScr;
writeln(' ');
readln(x);
writeln(' ' ) ;
readln();
st:=rek(x,y);
writeln(' ',st:12:3);
readln
end.


( ),
rek , rek.
.

180

: . .
: =1 .
,
. . , :
-1, .

,
else.
.
,
. \
-1 ( ), -2 . .,
k=i. k=i , . . . =2 . .,
.
.
. 8.6 =2,53 =10.
,
" ". XIII . :
,
. ,
. , , 8.7.
\ 8.7.
program rabbit;
Uses Crt;
var i,k:integer;:
function rab(n:integer):integer;
begin
if n=0
then rab:=l


else
if n=l
then rab:=2
else rab:=rab(n-2)+rab(n-l)
end;
begin
ClrScr;
writeln(' ');
readln(i);
k:=rab(i)*2;
writeln(' ',i, '
readln
end.

181

', k)

Tuibo Pascal

program stepint;
Uses Crt;
oar x,st:real; y:integer;
function rekCa:real;k:integer):real;
begin
if k=1
then rek:-a
else rek:=rek(a,k-1)a
end;
begin
ClrScr;
writelnC' ');
read lnC );
writelnC' ' ) ;
readlnCy);
st:=rek(x,y);
writelnC' ' f st:12:3);
readln
end.

Ifflg Tuibo Pascal



2.53

10

107'1.970

. 8.6. ()
()

182

rab(n), .
, . . rab(0)=i,
, rab(i)=2. 2
1, . . ,
. rab(2)=3 rab(2)=rab(i)+rab(0).
, :
rab (n) =rab (n-1) +rab (-2)

rabbit (. 8.7),
.
rab(n)x2. . 8.7 -12, . .
.
Pascal

Debug

pit l l ^ ^ d i

Tools

Options

Window

Kelp

program rabbit;
Uses Crt;
i,k:integer;
function rab(n:integer):integer;
begin
if n=fl
then : - 1

else
if B=1
then rab:=2
else rab:=rab(n 2)+r<)b<n-1)
end;
begin '
ClrScr;
writeIn(' ');
readln(i);
k:=rab(O2;
uritelnC' ',i,'
readln
end.

', k ) ;

3 (Slt<Fronpile~

Turbo Pascal

(n

* 1?

754

. 8.7. " " () (6)

183_

8.4.
, Turbo Pascal,
Crt.
. Crt
. , Turbo Pascal
.
turbo.exe
Turbo Pascal, System. Uses. , uses . ,
,
, .
System Crt Turbo Pascal . Graph,
, Turbo
Pascal. , . MS-DOS , Dos. , , Printer.
Turbo Pascal 7.0 , Graph3.
Graph3 Turbo Pascal 7.0 ,
Turbo Pascal. Overlay , .
, turbo.tpl. tpl Turbo Pascal library Turbo Pascal.
, Turbo Pascal
uses. , Turbo Pascal
.
,
.

184

, , , Turbo Pascal.
,

.
, Turbo Pascal
pas.
:
unit _;
interface
var _!: !; _2:2; . . . ;
f u n c t i o n _1 (!:1;
2:2;
f u n c t i o n _2 (!:1;
2:2;

. . .) :
...):

;
;

p r o c e d u r e __! (!: !; 2: 2; . . .);


p r o c e d u r e _2(!:!;
2:2;
...);
implementation
var _!:!; _2:2; ...;
function _!;
1;
!;
function _2;
2;
2;
procedure __1;
!;
!;
procedure _2;
2;
2;
begin
!;
2;
end.

. . unit (
"") . -

185

, ,
. ,
, ,
. ,
.
, , , .
,
. ,
interface. , . , . . ,
.
, , .
interface
. var,
,
.
,
. .
function, , , (
), . . , . .
procedure, .
, , .
implementation ( "",
""). implementation
, .
.
.
function .

186

.
, . .
, . begin, , .
end, .
.
.
, begin, end, .
, . , end .
,
pas.
prog, .
. ,
Compile. , . ,
. :
Compile successful: Press any key. ,

(. 8.8). Run | Run, ,
.
, , , tpu. , moduli.pas,
moduli .tpu.
,
Turbo Pascal.
Options, Directories. Directories (). , EXE & TPU directory,
,
tpu. Unit directories
, , , (. 8.9).

187

* Tuibo Pascal

I lie

tdit

Search

Run Compile

Debug

luu Is Options

Window

Help

unit nathen;
interface
function fakt(n:longint):longint;
procedure step(o,p:longint; s:longint);
procedure sredarifn(x,y:longint; sred:real);
procedure sredS
=* Eonpili
procedure sredj
procedure nod(|
implementation "
function fakt;
var i,f:longi
Destination: Bisk
Line number:
begin
Free memory:
288K
Total line:
f:=1;
for i:=1 to n
f:=f*i;
Compile successful: Press any key
fakt:=f
end;
procedure step;
i:longint;
begin
s:=1;
I1
11:33 =
] M H e l p | Ccnpile source
. 8.8. ,
Turbo Pascal

, , 7 D:, prog, d:\TP7\prog. ,


. .
Turbo Pascal

unit nathen;
interface
function fakt(n:longint):longint;
procedure step(o,p:longint; uar s:longint)
procedur
procedure
procedur]
ctery
procedur
inplenent
Delude directories .^
:
function
,>141 .
begin

f:=1;
!3lHm directories ]
for i:f:=f*i;
fakt:=f .
procedure
i:longint;
begin
s:=1;
==== 11:33 = =
. 8.9. Turbo Pascal,

188


. mathem, ,
. , ,
,
, .
, .
.
,
. , , , :

:
z:=sqrt(x*y);


. 8.8 mathem.
8.8. mathem
unit mathem;
interface
function fakt(n:longint):longint;
procedure step(o,p:longint; var s:longint);
procedure sredarifm(x,y:longint; var sred:real);
procedure sredgeom(x,:longint; var sred:real);
procedure sredgarm(x,:longint; var sred:real);
procedure nod(x,:longint; var d:longint);
implementation
function fakt;
var i,f:longint;
begin
f:=l;
for i:=l to n do
f:-f*i;
fakt:=f
end;

189

procedure step;
var i:longint;
begin
s:-l;
for i:=l to p do
s:=s*o
end;
procedure sredarifm;
begin
sred:=(x+y)/2
end;
procedure sredgeom;
begin
sred:=sqrt (x*y)
end;
procedure sredgarm;
begin
sred:=2/(l/x+l/y);
end;
procedure nod;
var i,k:longint;
begin
d:=l;
if x>y
then k:=x
else k:=y;
for i:=l to do
if (x mod i =0) and (y mod i =0)
then d:=i;
end;
end.

,
mathem.
, . . fakt . step . sredarifm
. sredgeom
, sredgarra . , nod
. , . .

190

. . end .
, mathem.tpu. ,
Turbo Pascal.
.
. 8.9 .
;

; 8.9. ,
program sumfakt;
uses crt,mathem;
var a,b,sumf:longint;
begin
ClrScr;
writeln(' ');
readln(a);
writeln(' ');
readln(b);
sumf:=fakt(a)+fakt(b);
writeln(' ',sumf);
readln
end.

. crt
mathem.
fakt,
mathem.
, . , 3, , 5,
. 8.10.

, . 8.10 .
8.10. , ,

program srednee;
uses crt,mathem;
var a,b:integer; arifm,geom, garm:real;

191

begin
ClrScr;
writeln(' ');
readln(a);
writeln(' ');
readln(b);
sredarifm(a,b,arifm);
sredgeom(a,b,geom);
sredgarm(a,b,garm);
writeln(' ',arifm:6:2) ;
writeln(' ',geom:7:3);
writeln(' ',garm:7:3);
readln
end.

Turbo Pascal
u tie * nejihoe
3

Cynrit 126

. 8.10. ,

Crt
mathem.
,
mathem. ,
.
, ( 3 5)
. 8.11.


mathem. ,
Turbo Pascal,
.

192
Tuibo Pascal


*|

3.873

3.750

. 8.11. ,
,


1. , . :

- a)(p - b)(p - ) ,
a, b , .
sqrt.

2. ,
,
. , .
abs, sqr sqrt.
3. , , (
0 9).
, . . true, false.

, .
4. ,
20 1 99, ,

193

( ,
).
, , .
5. , 1
10 000 . ,
, . , , .

7 . 1068


Turbo Pascal (. . 3.1)

( ). .
. .
:
. ,

( ,
, -, -).
, . . , , .
. pas,
, tpu,
,
:
(
, , Turbo Pascal);
doc ,
Microsoft Word;
x l s ,
Microsoft Excel;

196

bmp , Windows Paint.


, , :
progr.exe doklad.doc tabl.xls picture.bmp
, . .
: ,
, . : , .
. .
, .
, , "" .
(. . ) ,
.
, ,
: , . , , ,
, .

9.1.
.
.
:
var

_:text;

__ ,
; text .

197

:
var :text;
. CR ( ASCII
13) LF ( 10). , , ,
. ,
EOF ( end of file
). txt. , ,
- . , , , MS-DOS, Norton Commander
Turbo Pascal.
: - ,
. -, . -,
.
, , :
assign (_,

'_');

assign , "";
_ ; '_'
. , . ,
, , , , .
,
, .
:
assign

(k,'A:otchet.txt');

otchet.txt, , : , .
otchet.txt. -

198

,
"" .
,
. , :
reset (_);
_ .

,
read readln. read readln,
, : , , - , .
( ) close.
:
close{_);
_ .

.
, ,
Norton Commander.
D: obuch.
(, , Norton Commander , <Shift>+<F4>,
, <F4>.) comp.txt . ,
9.1.
! 9.1. ,
|
program obrtext;
Uses Crt;
var t:text; In:string[80];
begin
Clrscr;
assign(t/'D:\obuch\comp.txt');

199


reset(t);
while not eof(t) do
begin
readln(t, In);
writeln(ln)
end;
close(t);
readln
end.

Tuibo Pascal

i l i e Ldit Search Run Compile Debug Tool Options Window Help


U
.-jMi"~""-"--"!! i u i i a i i v > ^ - - > - - - e g m i
program obrtext;
Uses Crt;
var t : t e x t ; ln:strin9[8D];
begin
Clrscr;
assi|ii(t, 'O:\obuch\conp.txt');
reseUO;

while not rnfCt) do


begin

readln(t,ln);
uriteln(In)
end;
cluse(t);
readln
end.

. '
?HTuibo Pascal
flf iCUHdiU>HL4M KOnilbWiep BMHBHdt'i COCIdB
I -
1 . .
?. -^ .
3. KliilBHilTVpd
k.

. 9.1. () (6)

obrtext, : t, comp.txt, i n , -

200

.

assign. reset.

while. (eof), . . ,
. : not eof(t), ..
, eof
, false true.
, false, true.
.
readln in. (. . ) writein.
close.
.

, , rewrite, append.
:
rewrite (_);
append (_);

. . reset. ,
rewrite append -. rewrite
, . . (
) .
, append, ,
.
write,
writein. write writein
, , .
append .
comp.txt :
:
5.
6.

201

7.
8.

,
. 9.2.
9.2. ,

program doptext;
Uses Crt;
var t:text; In:string[80];
i,n:integer;
begin
Clrscr;
assign (t, 'D: \obuch\connp.txt') ;
append(t);
writeln(' ');
readln(n);
writeln(' .
"Enter"');
for i:=l to n do
begin
readln(ln);
writeln(t,In)
end;
close (t) ;
Clrscr;
reset(t) ;
while not eof(t) do
begin
readln(t,In);
writeln(In)
end;
close(t);
readln;
end.

, , : ,
, H i .
.
(
; 5).

202

. readln
in. in (. . )
writein. .
83 Tuibo Pascal
J i i e ^ t t U t >Jie*i4hi_fcun_Uorii|nle

Debug

I no I s

Upturns

Window ' Help

program obrtext;
Uses Crt;
uar t:text; ln:strinq[U01:
begin
Clrscr;
assignCt,'D:\obuchVconp.txt');
reset(t);
while not eof(t) do
begin
readln(t,ln);
writeln(In)
end;
closed);
readln
end.

!
:
1. .
2. .
3.
4 .
;*; :
5.
6.
?.
8.

. 9.2. : ()
()

203

,
. . 9.2.

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

,
assign , . , :
assign(nab,'D:\inf\nabor');

nab
nabor, D: inf. , , .

:
var _: f i l e of ;

__ , ;
f i l e ; ,
. ,
(integer, real, character, string, array).
:
var nab: file of character;

, ,
nab.

204

,
reset rewrite, close.
:
read {__1, _2) ;

_1 ; _2

, , .
: read (nab, r), .
:
write{_1,

_2);

writein readin
, . . . .
, , ,
.
, ,
. ,
.
, ,
.
. , . , alphabet obuch D: ,
,
9.3.
9.3. ,

program greek;
Uses Crt;
var
a:file of string; b:string; i,j:integer;

205

begin
Clrscr;
assignfa,'D:\obuch\alphabet');
rewrite(a);
for i:=l to 24 do
begin
writeln(' ');
readin(b);
write(a,b)
end;
close(a);
Clrscr;
reset(a);
for i:=l to 4 do
begin
writeln;
for j:=1 to 6 do
begin
read(a,b);
write(b, ' ')
end;
end;
close(a);
readin;
end.


assign, .
, .

. 24
( ). : , , readin . read (. . alphabet).
alphabet,
.
4 ,
6 . ,
. ( )
. .

206

. 9.3. ,

, greek,
,
. , ,

,
.
seek
. :
seek{_, );

seek , ""; _ ;
( , , ).
, . read , write
.
,
, f ilepos.
:
filepos{_):longint;

207

, .
, 9.4.
! 9.4. ,
j
program grsearch;
Uses Crt;
label 10;
var arfile of string; srchar; b,c:string;

l,m,n,x:longint;

begin
assign(a,'D:\obuch\alphabet');
reset(a);
repeat
ClrScr;
10: writeln(' ');
writeln('1 - ');
writeln('2 - ');
readln(m);
case m of
1: begin
writeln(' ');
readln();
seek(a,n-l);
read(a,b);
writeln(n,' - ' , ) ;
end;
2: begin
writeln(' ');
readln();
1:=0;
repeat
seek (, 1 ) ;
read(a,b) ;

iV-i+1
until c=b;
x:=filepos(a);
writeln(' ',,' ',,' ')
end;
else begin
writeln(' ');

208

9
goto 10
end;

end;
writeln(' (/)');
readln(s);
until s='H';
close(a);
end.


alphabet, . . writein ,

1
2. .
case, - .

alphabet, reset.
,
. seek (
), ,
, , , , n- -1. ,
, , , . seek ( ) read .
write.
,
, .
.
repeat. seek , . 1. 1 -

209

0. , 1 . "" , .
, ,
, ,
, . .
. filepos, .
, ,
writein.

1 2, - ,
case, else. ,
.
case.. .of
.
.
Tuibo Pascal
:;
1 -
2 -


16
16 -

(/

. 9.4. ,

210

. s
"", , ,
.
close ( ,
, ).
,
, "", ""
(. 9.4).

9.3.
,
, .

: , , , .
,
. , ,
.

:
var

_:file;

_ .
:
var

unt:file;

,
assign.
reset rewrite.
.
,
,
-, .
blockwrite.

211

:
blockwrite(_1, _2, ) ;
_1

; _2

, ;
, . .
:
blockwrite(unt,,1);

unt , (
), 1
.
biockread.
:
biockread(_1, _2, ) ;

_1

; __2

, ;
, . .
.
, , . . 8.1
, , , ,
, . 9.5.
9.5. ,

program qwurrez;
Uses Crt;
var
r:file; a,b,c,d,xl,x2:real; k,x:string;
begin
Clrscr;
assign(r,'d:\TP7\rez') ;
writeln(' ');

212

writeln(' Enter');
writeln(' ' ) ;
readln(a);
writeln(' ' ) ;
readln(b);
writeln(' ' ) ;
readln(c);
:=' ';
d:=b*b-4*a*c;
if d>=0 then
begin
xl:=.(-b-sqrt(d) )/(2*a) ;
x2:=(-b+sqrt(d))/(2*a);
x: =' ';
rewrite(r);
blockwrite(r,k,1);
blockwrite(r,a,1);
blockwrite(r,b,1);
blockwrite(r, c, 1) ;
blockwrite(r,x,1);
blockwrite(r,xl,1);
blockwrite(r,x2,l);
writeln(' ');
close(r)
end
else writeln(' ');
readln;
end.

, qwurrez,
assign ""
rez, D: 7.
2 + + = 0.
, , rez rewrite. , .
blockwrite
. , . ,
, . . rez,

. -

213

, . , ,

. xl 2
biockwrite
. writeln
.
, , close. ,
,
. . 9.5.
Turbo Pascal

Enter

2

7

3

. 9.5.

, : . , ,
, rez
.
rezread, 9.6.

I 9.6. ,
program rezread;
Uses Crt;

214
var r:file; x:real; k:string;
begin
Clrscr; assign(r,'d:\TP7\rez');
reset(r);
blockread(r,k,1) write(k,' ' )
blockread(r,x,1) write(x:7:2, '
blockread(r,x,1) write(x:7:2,'
blockread(r,x,1) write (x:7:2, '
writeln;
blockread (r,k, 1) write(k,' ' ) ;
blockread(r,x,1) write(x:7:2,'
blockread(r,x,1) write(x:7:2,'
close(r);
readln
end.

;
') ;
');
') ;

');
');}

, , . , qwurrez
7 ,

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

rez.
reset.
blockread, write. .
,
, . . . writeln . : , -

215

r e z .
, .
.
Turho Pascal
f lie

Ldit

"Search

ITjii

Compile

ilebug

loo I s

Uption

Window

Kelp

113

program rezread;
Uses Crt;
var r:file; x:real; k:strinq;
begin
Clrscr; assign(r,'d:\tp7\rez')
reset(r);
blockread(r,k,1); write(k,' ')
blockread(r,x,1); write(x:7:2,
blockread(r,x,1); write(x:7:2,
blockread(r,x,1>; urite(x:7:2,
writeln;
blockread(r,k,1); writc(k,' *)
blockread(r,x,1); urite(x:7:2,
blockread(r,x,1); urite(x:7:2,
close(r);
readln
end.

1:18

Turbo Pascal

-3.U0

2.00
-U.50

7.00

3.00

BOOJ

. 9.6. ()
(6)


1. ,
, (
,
*) ,
.

216

2. ,

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

.
4. , , : , , .
.
,
.

10



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

, . .
, "" ,
. , , , .

10.1.
,
,
, , . .
, , . . , , ,

218

10

"" . , , :
type _ -{!,

2,

...

) ;

type , "";
_

; !,

2,

...

(
).
:
type week=(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);

week ( - ""). 7 . . , , :
var ned:week;

. . ned week. ned (


, )
, , .
Monday, Tuesday
Wednesday, , , Day ( "").
,
-. , ,
( ,
). - case. : ,
; -, , ,
.
, .
-
, , . . , , . ,
-.
, , ,

219

,
. ,
Turbo Pascal,
.
, .
, , vocab ( vocabulary ""). 10.1.
; 10.1. , -
!
.;.

_.

,_,

program vocab;
Uses Crt;
type
sl=(error,main,key,mouse,hard,soft,user,power,cpu,sock,freq);
var
wrd:sl; term:string;
begin
ClrScr;
writeln(' ');
readln(term);
if term='mainboard' then wrd:=main;
if term='keyboard' then wrd:=key;
if term='mouse' then wrd:=mouse;
if term='hardware' then wrd:=hard;
if term='software' then wrd:=soft;
if term='user' then wrd:=user;
if term='power' then wrd:=power;
if term-'cpu' then wrd:=cpu;
if term='socket' then wrd:=sock;
if term='frequency' then wrd:=freq;
case wrd of
main: writeln(' ');
key: writeln('');
mouse: writeln('');
hard: writeln('');
soft: writeln(' ');
user: writeln('');
power: writeln('');
cpu: writeln(' ');
sock: writeln('');
freq: writeln('');

220

10

error: writeln(' ')


end;
readln
end.


si. ,
( ). ,
,
,
. error
(- ""). , .
wrd,
si. , term .

term -
. , , , . ,
- wrd . case.
-
, . , mainboard " ", frequency "" . .
,
, - error. case
:
.

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

221

. 10.1. "- "


1. , , si ( ).
2. if, term
( ), wrd ,
si.
3. case , writein .
.

10.2.
, . , , , ,
, -,
. -,
. -,
5. , 1, 2, 3, 4, 5.
.

, .
, -

222

10

( ). integer, longint, char, boolean, .


- .
. ,
,
.
:
type _ = ;

type ; , .
:
type mark=l..5;

integer. mark
1 5.
type l a t i n * ' a ' . . ' z ' ;
char.
.
type weekend=Friday..Sunday;

ned, . weekend
Friday, Saturday Sunday.


:
otmetka:mark;
bukva:latin;;
day:weekend;

,
.

. , bukva .
""
"" ( , . .

223

).
.
.
.
, . 40, , , . . .
, ? , ,
, . , , ,
integer, longint.
, ,
, . ogr,
1 12.
, .
,

. 10.2 , . 10.2 .
I 10.2.
{
program ftrl;
Uses Crt;
type ogr=l..12;
var f,i:longint;
n:ogr;
begin
ClrScr;
f:=l;
writeln(' ');
readln(n);
for i:=l to n do
f:=f*i;
writeln(' ',n,' ',f);
readln
end.

10

224
Turbo Pascal

program ftrl;
Uses Crl;
type ogr=1..12;
uar f v i:longint;
n:ogr;
begin
ClrScr;
f:=1;
uritelnt' ');
readln(n);
for i:=1 to n do
f:=f*i;
writelnC ' , , ' ' , f ) ;
readIs
end.

Pascal

1?
12 791&00

. 10.2. ()
()

,
, - "" ,
. , 20, .
Turbo Pascal ,
.
Options, Compiler,
Runtime errors
Range checking,
.

225

. ,
, .

10.3.
, . , , .
,
.
- , .
: , , ,
, , , ,
. .
, ,
, ,
. , 1960 , -, ,
20 , 10 , . ,
, , ,
:
fam, im, o t c h , m e s t o , o b r : s t r i n g ;
: fam: = ''; im: = 'IIeTp'; otch: = '';
mes t o : ='-'; obr: ='';.

"" ,
. . :
pol:char;
1: = '';.
, :
god,stob,stpr:integer;

god: =1960; stob:=20; stpr:=10;.


, , ,
8 3. 1068

226

10

(. . ,
, )
ball:real;

, 4,78: baii:=4.78;.
,
, .
.
. .
, . :
type _ - record
_1 : _1;

_2: _2;
__: __;
end;

type, record end (record


""); _ ; _
, . .
, , -
:
type anketa=record
god,stob,str:integer;
ball:real;
pol:char;
fam, im,otch,mesto,obr:string;
end;

. . , anketa, 11 , 4 . , ,
, , .
, ,
, . ,
, ,
, ,
date, den, mes gr. , .

227

, date :
date:record
den, gr:integer;
mes:string;
end;

anketa. , god,
anketa , .
:
type anketa=record
stob,stpr:integer;
ball:real;
pol:char;
fam,im, otch,mesto,obr:string;
date:record
den, gr:integer;
mes:string;
end;
end;

end,
date, anketa .
anketa . , otdei, , , :
var otdel:array[1..n]

of anketa;

.
10 , 9 , , 3 .
, "" .
kadry.
kad, kadry, :
var kad: file of anketa;

,
, . ,

228

10

, .

,
( , ,
. .). :
_._

, . .
,
, :
anketa.stob:=21;

( )

anketa. stob: =11;

( )

(, 22 1960 ),
:
anketa. date. den: =22; ( )
anketa. date .mes : ' ';
anketa.date.gr:=1960;

( )

( )


(. 10.3). , , , , : , , , .
: .
,
10.3.
| 10.3. ,
program telefon;
Uses Crt;
type punkt=record
fam: string; name: string; nomer:string; adres: string;
end;
var abon:file of punkt; v:punkt; k:char;
begin
Clrscr;

229

assign(abon,'D:\obuch\sprav');
reset(abon);
if ioresultoO then rewrite(abon);
repeat
writeln(' ');
readln(v.fam);
writeln(' ');
readln(v.name);
writeln(' ');
readln(v.nomer);
writeln(' ');
readln(v.adres);
write(abon,v);
writeln(' ? (/)');
readln()
until k='H";
readln
end.


punkt, , 4 : ,
, , . . abon. sprav punkt.
v punkt. .
sprav
reset . ,
, .

ioresult.
- ( ). .
- , ioresult .

. ioresult , , , , . , , ,
reset.

230

10
Wj Turbo Pascal

El ile
ri

OTiT

Search

Kun Compile

--

Debug

tools

Options

mir>Hjriiii'.'jtn<i'iuii

Window
. -

Help

progran telefon;
Uses Crt;
type punkt=record
fan: string; name: string; noner:string; adres: string;
end;
war abun:file of punkt; v:punkt; k:char;
begin
Clrscr;
assign(abon,'D:\obuch\sprag');
reset(abon);
if ioresultOO then rewrite(abon);
repeat
writeln(' '); readln(v.fan);
writeln(' '); readln(M.ndne);
writeln(' '); readinCu.nomer);
writeln(" '); readlnCv.adres);
write(abon,v);
uriteln(' ?(/)'); readln(k)
until ='";
read In
end.
21:18

Tuibo Pascal

. 200 .1?
?(/)


? ?? 2? ?2

yti. . 33 . 123
?(/)


! !(1*
leiteijiuHd dt>oneHla

3-33-33-33


.23^ . 99
byueie <11 VCJI/B)

LJ6
. 10.3. , (),
()

.
repeat.. .until. ,
writeln, , , .
readin v. , v , -

231

sprav abon. , . , ""


"", .
. "".
.
telsprav sprav,
.
punkt, abon punkt, i fff.
10.4.
10.4.
program telsprav;
Uses Crt;
type punkt=record
fam: string; name: string; nomer:string; adres:string;
end;
var
abon:file of punkt; v:punkt; i:integer; fff:string;
begin
Clrscr;
assign(abon,'D:\obuch\sprav');
reset(abon);
i:=0;
writeln(' ');
readln(fff);
repeat
seek(abon,i);
read(abon,v);
i:=i+l;
if v.fam=fff then
begin
writeln(' ', v.fam, ' ', v.name);
writeln(' ',v.adres);
writeln(' ', v.nomer)
end;
until eof(abon);
readln
end.

10

232


sprav . ,
,
, .
fff. , .
,
repeat.. .until, . seek. , ( i, ,
). i-ro - v.
if v,
(v.fam) , fff. , writein , : , , , . .
. , , , . . , , ,
(eof). ,
. , , . . 10.4.
^ Pascal
3K.<s;ie ||1<1)

<> {'
.23 . 99
3-33-33-33

. 10.4. " "

, , , ,

233

. ,
, , - ,
. , , . , .
:
tabel:integer;

:
anketa.tabel:=4567 ;

tabel , . . ,
.

10.4.

,
, .
, . ,
,
.
(, , ,
, ) ,
. , , . , 33 26
, , ,
, , .
, ,
- , .
:
var : set of ;

234

10

var set . set ", "; _ -,


;
,
.
(.
. 10.2). -
, , " . . " .
, , ,
.
.
var triznak: set of 100..999;

.
integer.
var prop: set of

'A'..'';

. char.

, . . "" ""
, "" "" .
var compon: set of (keyboard, motherboard, mouse, display)

, .
.
-, . , , ,
255.
""
. : [1,2,3,4,5,6,7,8,9] ,
. ,
[1] [].
.
, , . ,
, , , .

235

, * (),
, , . , , . , "" [20,30,40],
:
:=[20,30,40];

[30,40,50],
:-[30,40,50];
:=*,- [30,40].
+,
.
, ,
. : lat, [q,w,e,r,t,y], rus,
[,,,,,,] ( , ). iatrus:=iat+rus;
latrus : [q,w,e,r,t,y,ii,u,y, , ,,].
, -, .
, ,
. : language
low. ,
,
, .
. :
language:=[basic,pascal,,fortran,algol,assembler_language,machine_code];
low: = [asseinbler_language,raachine_code] ;

high:
high:=language-low;

high :
[basic,pascal,,fortran,algol], .. .

236

10

.
. , ,
, . , true
false. .
= (
).
< > (
, ).
: G .
G [4,5,6]. [4,5,6]. G = true,
G < > false. , [6,7,8], a G ,
G = false, G < > true.
< (. .
. , -
).
< = (
. ,
- .).
> .
>= .
: L. [10,15,20], L [, 15,20,25,30]. K<L K<=L true. K>L
K>=L false. L [, 15,20],
. K<=L K>=L true, K>L K<L false.
,
, - . one-

237

. :
in [_] ;

, ; i n , ""; _ , .
true, (. .
), false, .
, D in [..] 5 in [3,5,7,9] true, a
D in [E..N] 5 in [7,9,11] false.
, ,
.
*.
+ - . in, =, < >,
<, <=, >, >=.
, , .
, .
-
.
, , ,
. ,
, .
10.5.
| 10.5. ,

program filolog;
Uses Crt;
var
gl,sog:integer; a:char;
begin
ClrScr;
gl:=0;
sog:=0;

238

10

writeln(' . ' ) ;
write(' E n t e r ' ) ;
writeln(' 0 E n t e r ' ) ;
repeat
repeat
read(a);
if a in [ ' ' / ' / ' / ' / ' / ' / ' / ' / 1 ,
' A \ ' E \ ' \ ' ' , ' , ' \ ' ' , '', ' ' ] then g l : = g l + l ;
if a in [ ' 1 . . ' \ ' ' , ' ' , ' ' . . ' ' , ' ' , ' ' . . ' ' , ' ' . . ' ' ,
' ' . . ' \ ' ' , ' 3 \ ' ' . . ' 1 , ' ' . . " ' , ' ' . . ' ' ] then sog:=sog+l
u n t i l eoln;
until a='O';
readln;
w r i t e l n ( ' ' , g l ) ;
w r i t e l n ( ' ' , s o g ) ;
readln
end.
.
read . , , repeat.. .until. if . '
, - gi
. ( - .)
. - sog.
. eoln.
false, CR LF (. . 9.1) true, .
repeat.. .until
, .
, , .
writeln. . 10.5
f iiolog.
,
,

239

, . . .

1 . ,
, . III " ". ,
(
8), .
iTuibo Pascal
. "Enter"
"Enter"

- ,
.
, .
77
102

. 10.5. ,

. 1 (
) , 2 ( 2 , . . ).
2 . 3.
, 3, 3.
( 5) . , /2 (
, /2). 1 ()
. 10.6 ,
" ".

240

10

\ 10.6. (" ")


program eratos;
Uses Crt;
label 1;
var
dpn:set of 1..255; i,j,k,l,n:integer;
begin
ClrScr;
writeln(' 1 ' ) ;
1: writeln (' ( 255)');
readln(n);
if n>255 then goto 1;
k:= n div 2;
dpn: = [2..n] ;
for i:=2 to k do
for j:=2 to n do
if (j mod i =0) and (joi) then dpn:=dpn-[j ];
writeln;
writeln(' 1 ',);
writeln;
write(l:4);
1:=2;
for j:=2 to n do
if j in dpn then
begin
write(j:4);
if 1 mod 10 =0 then writeln;
1:=1+1 end;
readln
end.

,
.
255, . . .
( ,
255), , .
, 2 /2. -

241

. , dpn
, , .
, dpn
.
. i, 1 , . .
, "" , .
, j
.
j .
j i ,
, , ,
, .
dpn , .
,
. j , 1 .
. write (
writeln, ,
25,
). . .
, , - ( ) "" ,
, , ,
.
:

4 , , . .
, , , .
10 , ,
, 40 .
80 . 10 -

242

10

: ,
, - 1.
. , 10 , 1
10.
10. 1 10,
writeln.
, 1 2
( ). ,
. 10.6.
2 Turbo Pascal
ilporparaa 1
( 255)

( 255)

1 251
1

2
3
5
7 11 13 17 19 23
31 37 ( 43 7 53 59 61 67
73 79 83 8? 97 11 103 17 109
113 127 131 137 139
151 157 163 167
173 179 181 191 193 197 1S9 211 223 227
229 233 239 241 251

71

. 10.6.


1. ,
. - .
.
2. , , . ,
4 (, 1996 2004).

243

, 100. , 400 (, 1600 2000 , 1800 1900 ).


, , ( 1600 2100).
( Turbo Pascal).
3. ,
.
. : , : , , , . , ,
, , .

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

1 1

Turbo Pascal

,
.
, , . ,
.
Turbo Pascal

.
, ,

,
Turbo Pascal. .
, Turbo Pascal.
Turbo Pascal. , , ,
, .
, . .
.
. -, , -

11

246

. -, Turbo Pascal .
, , . ,
.
http://borlpasc.narod.ru , . -,
1, Turbo
Pascal, Turbo Pascal 7.0, .
-,
, , , , Turbo Pascal
(. 11.1).
IJ - Micioseft Internet Exploiei

. -./' .'!.'.

_*j

jasj http:/'/boripac.narod.ru/schedule.h(fn

-fipxuB
iA!B|C|D|E|F|G!Hil|J!K|L|M|N|O|P|Q|R|S|T|U|V|W|X|YIZl
||||||1|||||||0|||||||!|!1!|]|

TURBO PASCAL

Borland Pascal.
1993.
|2

![ "Windows. .

orland Pascal.
1

Turbo Vision , 1993

i A*

;| 6.0.
ip
]6

[ 6.0. .
(


i f
I /* '

. 11.1. borlpasc.narod.ru, Turbo Pascal

, , , , Turbo Pascal (. 11.2).


( ) FAQ,

247

Turbo Pascal

Frequently Asked Questions, . . "


".

JJJ -^ ,

TURBO PASCAL
f

FAQ
FAQ SLY

GolOVanov

%. \ folqaioT?
1.2 ?
1.3 6 ,
7?
1.4 7 7?
1.5 , ..?
1.6 200 ("Divide by Zero4) ?
1.7 ,
?
*
. 11.2. boripasc.narod.ru,

,
(. 11.3). , . , , , , , ,
, .
, ,
,
(. 11.4).
http://pascal.sources.ru " " (. 11.5).
,,
, ,
, (. 11.6):
http://www.kolasc.net.ru/cdo/metod/programmer'scourse/language
/index.htm#pascwil

11

248

BHQ

'

j JCI hltp://boilpas.cnaiod.ru/piog htn

..
!
TURBO
^
UuBfiCIH...

.,
CONTBtT.MAIL.RU

E-mail:

Turbo Pascal

,.rru

""

? new1)

EAQ

. 11.3. borlpasc.narod.ru,

1 1
I j ^ hltp;//www.Nveioufnat.com/users/luibopascalI

Turbo Pascal

20 most recent
20

JJ

-3

=i

-.
:

V -..
j j : ^ ! \ ;

Mon, Jan. 3rd, 2005,11:25 am

Recent Entries
Archive
Friends
User Info

f Borland Pascal]

.
,


, , ,
.
, ,

.
Link Leave a comment
Fri, Dec. 3rd, 2004,12:20 pm
.
www.yourpascal.com
" "
950

. 11.4. borlpasc.narod.ru

249

Turbo Pascal

fim

/.

ffp| web.snurccs.ru
idbc.sources.ru asp.sources.ru

[45]
Pascal [60]
[22]

[31]
[4]
[10]

J1]

[13]
! ;)

11.04.2003 Unix. X Window Free Pascal

!

-

X
Window (Unix) FPC.

,

: FPC 1.06

.[......

24.10.2003

07.04.2003 Inertia 3D rendering system

.Ru CD

,


,
,

Pascal -!

Development Corporation
Co
)

Pascal.


DOS32, Win32 Linux.

. 11.5. " "

&

- v ; <"
^
. .
.
J httpV/www.koiasc.net.iu/cdo/nieti'jd^pfograrnmet'scoijtse/language/indexhlmtlpdscwil

I Pascal

WWUw i ^

-LJ*

I".

yjUmiii

'

. 11.6.

250

11

http://delphid.dax.ru/pascal "Development
", ,
Delphi, , (. 11.7).
Borland Pascal 7.0,
Turbo Pascal 7.0. Borland Pascal
(help) . ,
Turbo Pascal,
.

Pascal - Mic.iosull Internet Fxpl

ii^.-n^-rJ--...

- .

.
j*J

[ # ] http://delpNd.dax.ru/pMcal/

Development
1

; :

1200MC f { i " COI-BIN ; .fctaceess


1. ' "

I ssr""'"). myssi
. :

Pascal

[ ] [ ]
*

Turbo Pascal

Turbo Pascal.
,
- .
Turbo Pascal Delphi
. .

cpenv Borland Pascal 7.0


(

1. Turbo
Pascal
"

. 11.7. "Development ",


Turbo Pascal

http://web-pascal.narod.ru . , , (. 11.8). ,
Borland, ,
, ,
.
, ,
Turbo Pascal,

251

Turbo Pascal

2,'

'

*]

=; .**

::: :::
:

Dos
I , .
I dos-,
edit.
Norton Volcov Commander1 F4
.
Windows commandere F3 ( )
S (DOS ),
I 1 ... [ WnrriP-aH fr\\tr.w-

. 11.8. "Web-Pascal",

'

^:

'^. I;

;:: :::
Pascal ,
1933 .

:
Borland Pascal v7.0 - XX
. " "
DOS,
16- Winl6 (Windows 3.1)1
: 09 1993.
: 873 kb


. Windows

. 11.9. 'Web-Pascal",

252

11

1.0 ,
(. 11.9).
http://www.pascal.dax.ru
" ". ,
. ,
, , , , , , , , , .
(. 11.10).
1 Dp4a
1

gm '** &

?":':.- ,

. ..

..1 ;>

] &aped j^S] hUp:,Vwww.[Mscal.da)i.ru/?soi*s


..:: < IIVI* " > ::..
-
cafiTaJ [___
; __ _ _ ___

_._.
j
[13 164 ]

[15];

[14]: .

[6]: ,

[21]:

[43]: .

[7J: .
[5]:

[21]; ,

[]; . .
[5]: .

[9]; .

[]; * ,

. [4]; , , ,
::
,,
,
; $/
.|1.11
(
I Professional

\0

. 11.10. pascal.dax.ru,

http://www.karelia.ru/psu/Chairs/IMO/pascal , ,
,
(. 11.11).
http://www.kbsu.ru/~book - . 3. (. 11.12).
,
, .

253

Turbo Pascal
q - Microsoft Interne! Exntotei

E m

.!;

. kareiia. ru/psu/Crws/l M 0 /pascal/

] -^ J

!
!

. 11.11. ,

. 11.12. , -
. 3.

254

11

, ,
,
, Turbo Pascal (. 11.13).
Turbo Pascal.
111 - Micinsoft Internet Fiplorer

^ J ^ - *'

Wtp7/'www.kbsu(u/"'Dook/piaclice/ffideK.html

.
. Turbo Pascal Quick Basic.
: .
1. .
2. , .
3. , .
4. , .
5. , .
. , .
7. .
JBO

40

. 11.13. ,
- . 3.

http://trushinov.chat.ru/sp.htm . . , , Turbo Pascal:


, , , . (. 11.14).
http://www.markbook.chat.ru
. . , Book (. 11.15).
, Turbo Pascal.
http://www.belc.narod.ru/train.htm . . ,
Turbo Pascal, a
(. 11.16).

255

Turbo Pascal

.: Htp.Miuslicnov.chat.ru/sp.htm

OB. :

english
science

Turbo-Pascal ,
- .
. ,
(, )
Delphi.
. >
'
\ .

dynamic Lap

27K

dynauur2.rip

23K

. : .

.. '". '

,. .
!

. 11.14. . . ,
Turbo Pascal
'

etn

> .

.. '::

. Cgpew;' ^ "

Ji

'
:

<

'

&

<5

'

"

"

"*

"

'

- .:

"

..

Jt

j g ] hp://www.makbook.chat.

E-mail: marklv25@tntU'netru

BOOK
9-11
: IBM PC, MSDOS, Norton Commander, Windows Commander , Windows
95, Microsoft Word, Excel, Works, -, QBasic, Turbo
Pascal, HTML . HTML,
Internet Explorer Netscape Navigator.
.
!

BOOK:
' -

. 11.15. . . ,
BOOK

11

256

'

: gift $ *

!.,*:.

;.* j@3

'...-> ...

1
'

& : . - j y ,
^
. .

.
J

hitp7/www.be!c.ratod.tuArain.htm

' .'
{"*

M^ndows 95

Norton Commander

MS-DOS Norton Commander


(5323X6)

" "

" "
4j

"

'

'

'

'

! ^ .

. 11.16. . . ,

,
, Delphi, .

1 2


Delphi

Delphi. , Delphi Object Pascal,
Turbo Pascal. Delphi . ,
. . .

12.1.
Delphi
8 Turbo Pascal
MS-DOS, 90- XX Windows,
Window-. Borland. , ,
Delphi. , Delphi ?
Delphi
Windows, Windows, Delphi , .

,
9 3. 1068

258

12

( 23 ).
Delphi, , Windows.
, , , ,
. Windows,
. ,
, ,
.
, "" , , Windows. ,
().
Delphi , , Windows, . .
, , . Borland Delphi
,
, Windows. ,
, , , .
, Windows.
Delphi - . , Turbo Pascal,
, Delphi . , , Delphi ,
.
, ,
, , ,
.

, ,
, , .
MS-DOS.
, , .
, . ,

Delphi

259

,
. .
. ,

"" ( Visible). visible true (), ,
visible false (), .
.
, , , ,
, , , , . .
. .
, , . ,
. , , , , <Enter>,
, ,
, . ,
, , .
, Delphi -
. - , , .
Delphi , , Object
Pascal,
Turbo Pascal. , , .
Delphi . ,
,
.
. , , . .
, , . ,
.
, ,
. -

260

12

,
, , Delphi
Height width ( ).
, .
. Font (). , ,
( ).
, ,
.

, .

12.2. Delphi
, Delphi,
. ,
.
. -, . Borland Inc.,
.
- .
. , ""
100 , , ,
. , 10 ,
,
20 . -, , .
-,
. , .

Delphi

261

Delphi 5.0, 6.0 7.0.


Delphi (

).
,
.
, . . . .
Delphi 6.0 (. 12.1).

. 12.1. Delphi

, , (
) . , Delphi 6
( ) ( ),
: "Requires 350 mb hard disk space for
full install". , 350 . , . .

262

12

(Windows Installer) (. 12.2).


, .
I Windows Inst.illiti

. 12.2. -


,
Delphi (. 12.3). Installation Wizard, " ".
fa- Boiland Delphi 6 Enteipiise Edition - Installation Wizaid

Borland*

Welcome to Borland Delphi 6, Enterprise


Edition
The Installation wizard will Install Borland Delphi 6 on
your con^uter. To continue, click Next.

1..."?...:",

. 12.3. Delphi


Next ().
,
(Serial Number) -

Delphi

263

(Authorization Key) (. 12.4).


.
, -.

Serial Number
Please enter the serial number and authorization key found on your Delphi CD.

Jerisl Number:

^ Authorization Key:

< Back

Cancel

. 12.4.

.
( ) . ,
. <>
. ,
. ,
Next.
, ,
, ,
, . , . ,
Next .

264

12

( ).
, , ,
(. 12.5).

License Agreement
Please read the following license agreement carefully.

BORLAND DELPHI ENTERPRISE VERSION 6


BORLAND NO-NONSENSE LICENSE STATEMENT AND LIMITED WARRANTY
IMPORTANT - READ CAREFULLY
This license statement and limited warranty constitutes a legal agreement ("License
Agreement") between you (either as an individual or a single entity) and Borland
Software Corporation ("Borland") for the software product ("Software") identified
above, including any software, media, and accompanying on-line or printed
do cumentation.
.

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

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

< 1 accept trie leims in the tcensc agreement

(~ I $o not accept the terms in the license agreement

< Back

Next >

Cancel

. 12.5. Delphi

.
,
, I do not accept the
terms in the license agreement ( ). .
, I accept the terms in the license
agreement ( ), Next .
(. 12.6). ,
, , . ,
, , -

265

Delphi

,
.

Important Installation Information

Delphi 6

Installation Notes

This file describes issues that may affect the installation of this product. We
recommend that you read it in full before continuing. The contents of this file are
available on your CD for later printing or viewing.
Other notes, including known issues, compatibility information, and uninstallation
information, are contained in the product READMEfile,also available for review or
printing after installation from your CD or from your installation directory root.

< Back

"flJElEZ

Cancel

. 12.6.

, :
Pentium
166 ( Pentium 2 400 );

Windows 98 (Windows 2000, Windows ME . .);

64 ( 128 );

115 350
;
-;

640x480 ;
- (, ).

266

12

,
, , .
Next .
(. 12.7). : Typical (), Compact () Custom (
).
. , . ,
.
,
, ,
, .
,
.
. Next .

Setup Type
Choose the setup type that best suits your needs.

Please select a setup type.

Typical
Program will be installed with the most common options. Recommended
for most users.

Program will be installed with the minimum required options.

Custom
Choose which program features you want installed and where they will
be installed. Recommended for advanced users.

<Eack

Z"M*O~]]

Cancel

. 12.7.

Delphi

267

, VisiBroker.
(. 12.8).
, , No VisiBroker/CORBA Support. Next
.

Choose VisiBroker
Choose the version of VisiBroker which should be installed.

<~ VisiBroker 4 (IDL2PAS CORBA solution)


Install VisBroker 4 and 1DL2PAS Delphi components. DII support Is not provided. This
detect and, if necessary, will Install Java Runtime Environment 1,2.2.
f

VisiBroker 3.3 ( D I I CORBA solution)


Installs VisiBroker 3.3 for Delphi and Delphi CORBA components. This option provides
support for DII and client- and sever-side IDL2Pas.

( N o VisiBroker/CORBA Support!

<Back

. 12.8. VisiBroker

, Microsoft Office
(. 12.9). Office 97
Office 2000, Office 97,
.
Office 2000 Office XP,
Office 2000. Next .
,
InterBase Client (. 12.10). ,

268

12

Microsoft: Office Controls


Choose the version of Office controls to use as your default.

Both versions of Office controls will be installed. However, only one set of controls
can be registered. The option you choose on this screen will determine which set of
controls will be registered. See the documentation for instructions on changing the
Office control set after installation.

office 000

< Back

t(ext >

Cancel

. 12.9. Microsoft Office

i I Borland Delphi 6 Enterprise Edition - Installation Wizard


Install Additional Components
Setup has determined that there are additional programs needed for all of the
features to be fully functional. Choose the programs you wish to install.
Vou can install these programs now or install them later from the CD.

Install InterBase Client

"

C a n c e l

. 12.10. InterBase Client

.
10 , , , -

Delphi

269

.
, .
Next .
(. 12.11). ,
I agree with the terms of this license. ,
I do not agree. Installation will continue, but without remote data functions,
,
.
Next .

Remote Dataset License Agreement


Please review the remote dataset license agreement. To install this feature, you
must agree to these terms.

ADDITIONAL LICENSE TERMS


FOR DEPLOYING MULTI-TIER PROGRAMS
This version of the software may include redistributable files identified as
"ClientDatasetRedistributables" for creating multi-tier application programs.

* I agree with the terms of this license.


~ I dp not agree. Installation will continue, but without remote data functions.

< |ack

NexFS

Cancel

. 12.11. ,

, (. 12.12). ,
: ,
Program Files\Borland\Delphi6.
,
Change. ,

12

270

.
, , Next .

E3I!

1 Borland Delphi 6 Enterprise Edition - Installation Wizard


Destination Folder
Click Next to install to this folder, or click Change to install to a different folder.

mm\\

Borland Delphi 6 will be installed to these, locations;


program Files
Change...

|c\Program Files\Borland\Delphi6\
Shared Files
jC:\Program Files\Common Files\Borland Shared\

Change...

BDE and SQt,Links


Change.,.

]c:\Program Files\Common Files\Borland Shared\BDE\


Database Desktop

|C:\Program Files\Common Files\Borland Shared\Database Desktop^

<.

|[

ijjexb

Change..,

3|

Cancel

. 12.12.

Save Installation Database


Choose whether the installation database will be saved to your hard drive.

To uhhstall Borland Delphi 6 from this computer, Windows Installer will need access to
the installation database on this CD. You can choose to save this database file (about 5
MB) to your hard disk drive so that the CD will not be required to : remove Borland Delphi

NOTE: The installation database that Is copied to your hard disk drive can be used only to
uninstall Borland Delphi 6. If you wish to repair or add features to your Installation, you
will need to use your original product CD.
Save installation database to hard drive (recommended)

Cancel

. 12.13.

Delphi

271

,
(. 12.13). 5 .
,
, -.
, . Next .
, , ,
(. 12.14). ,
Install (), .

Ready to Install the Program


The wizard is ready to begin installation.
Click Install to begin the installation,
If you want to review or change any of your installation settings, click Back. Click Cancel to
:
exit the wizard.
:
. '

Please note that SOAP and W5OL are evolving standards. The new Web
Services features may change to support changes to the standard and
Interoperability with other implementations. Check the release notes for this
product and www,borland.com for the latest information on standards and
interoperability support.

Cancel

. 12.14. , , -

Install , , (. 12.15).
.
.

,
. -

12

272

, , .

Installing Borland Delphi 6


The program features you selected are being installed.

Implement enterprise-class e-business applications


Build uttra-high performance rich GUI clients for Borland*
VisiBroker* for CORBA* and Borland* AppServer for
EJB applications.
Import EJBs for Borland AppServer to Delphi and
publish them as Web Services with BizSnap,
Build server applications that interoperate seamlessly
in heterogeneous enterprise environments.
Status; Copying new files

Illlllllllllllllllllllll

. 12.15. -,
,

,
InterBase Client (. 12.16).
,
Next. ,
InterBase Client
(. 12.17).
, (. 12.18).

Yes (). ,
(. 12.19). . , , . ,
.
, Install.

Delphi

273

I InterBase Client setup


Welcome to the InterBase Client setup program. This
j program will install the interB ase Client for Windows on JIOUI
compute!.
.' " : .
It is strongly recommended that you ertit all Windows
programs before running this Setup program.

WARNING: This program is licensed under the InterBase


Public License which gives you certain specific rights and
imposes certain responsibilities. You may distiibut this
program under the conditions described in the file license.txt.

Mext>

Cancel

. 12.16. InterBase Client

Important installation information


The install.txt file contains important information on installing the InterBase Client. Pleasi
take a few moments to read this file before proceeding with the install.

WELCOHE TO INTERBASE 6
Installation and issues for InterBase 6
for Windows 2000/NT and Windows 98/HE.
PREPARING TO INSTALL
1. SAVING OLDER DATABASES
InterBase 6 uses On-Disk Structure (ODS),
ODS 10. Databases created with InterBase 4.0

< Back

TJSST

Cancel

. 12.17. , InterBase Client

, . ,

Finish () (. 12.20).

12

274
Software License Agreement
Please read the following License Agreement. Press the PAGE DOWN key to see the rest
of the agreement' j

INTERBASE MEDIA KIT


LICENSE STATEHENT AND LIMITED WARRANTY
IMPORTANT - READ CAREFULLY
This License Statement and Limited Warranty
constitutes a legal agreement
("License Agreement") between you (either as an
individual or a single entity)
and Borland Software Corporation ("Borland") for
the software product (the
,

^|

Do you accept all the terms ol the preceding License Agreement? If you choose No, Setup
wil close. To install the product you must accept this agreement.

(Back

Yes

No

. 12.18.

InterBase component selection
Select the components you wish to install.
iS3 Command-line tools
Graphical tool
0 Software development support
Example programs
InterBase Replication Manager
r Description
:

InterBase 32-bit Client, required to connect to an


- InterBase server.

Destination
jCAProgram Files\Borland\lnterBase
Available:

3858536 Re

<B_ack

Install

Siowse..
9844' K.

Cancel

. 12.19. ,
InterBase Client

InterBase Client ,
Delphi 6, ,

275

Delphi

,
Finish (. 12.21).
InterBase Client setup complete
The InterBase Client is now installed on your computer.

For a description of new features and changes in InterBase


6, use Acrobat Reader to view the ReieaseNotes pdf file in
the InterBase horne directory. If you do not have Adobe :
Acrobat eader 3 With S earch installed on your system,
choose "Install Adobe Acrobat Reader" from the InterBase
setup launcher.
Copyiight (c) 2001 Borland Software Corp.
All rights reserved.

. 12.20. , InterBase Client


\$- Boiland Delphi 6 Enteiprise Edition - Installation Wizaid

Borland*

Installation Wizard Completed

The installation wizard has successf ully installed


Borland Delphi 6. Click Finish to exit the wizard.

.".

lL._..sr>i5ti

'-".-<-

. 12.21. , , Delphi 6

276

12

,
, . Yes, No.
, Yes. . ,
Delphi 6.0 .
, ,
(Start), (Programs) , Borland Delphi InterBase.

-, -,
, . Delphi
,
( ).

12.3.
Delphi Windows, , , . (, , Delphi
,
).
, ,
Delphi32.exe.
Program Files ( , , :), Borland,
Delphi,
bin. Delphi32.exe. ,
,
, Web.
.
, -

Delphi

277

Borland Delphi, Delphi.


.
Windows Delphi32, ,
- .
,
Web.

,
Borland Delphi, Delphi.

Delphi. .

1 3


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

13.1. Delphi
, Delphi. (. 13.1), (. 13.2)
(. 13.3) Delphi.
(. . 13.3):
;
( );
;
;
;
;
.

280

13

AutoSize ' -False


iDiMode
BBordeitcon
BwdeiStyte ; bsSi;eab(e
BorderWttb : 6
[ . C a t i o n .,.;Form!
3*8
aWJh
536
M
'
;
f
(TSi:eConslrari

aDeltt

: Ctjfsoi

DefaukMonitof n c
| DiS
False

. 13.1. Delphi 5
Delphi 6 - Piojecll
File | * Jeerch Viem Piojeci Hun Ccmponenl QaHbase Joels * 0 "

? ' H

?2 b Si

| ;l|'None>

Si ^ ^

S l a n d a l < l | Addlionel j Win32 j Slmj DetaAccessl OalaCuioll dbEraets j DalaSnanl BDE

<

3 f<mY

-\

Forml

PiepeHiM | Events I
ActiveCortiiiii
Align .
aNons
[ Alphaeloml
I AlphaBlendVjk 25!
BAnchots
|W.efUkTopl
(
' AutnScrd
1 frue .' ':"..
;False ": v >; ", "
I AutoSize
! BiDWode
ibctteltTtjpfigh*
;!3Borderlcons . ' IbiSystemWenu,
biSiieabte
! BodeiSlyl
BocdoiWijIh'
1 Capibn . ; Foimi
o "

iAI shown

'"

'zl
I aywlaollWQid-pitt13Z

|[;>Dlphi 6

. 13.2. Delphi 6

-iK' 23M

Delphi

j j j j \\

281

Standard I Additional I Wrfl21 Svitert, I Data Access 1 Data ConlraM DataSnao I BDE I ADO I t y . i L !

' "i

APT

. 13.3. Delphi 7

. , .

Delphi . Delphi , .
Projectl. ,
, .
.
,
. ,
.
. , .
,
. ,
, .
, ,

282

13

,
.
, , ,
File (), ,
, . . . Save as (
) , ,
,
. New (
) , ,
,
(, , . .),
.
Edit (
, ), . , . ,
. - , Cut (
), ( ), Paste
( , ), Delete
( ) .
, . , . . , . ,
, ,
. Delphi .
.
,
.
, . .
.
.
.

283

Delphi

, . ,
. . .
,
. , .
, , .
, Windows. , ,
"". ,
, .
, ""
"". "" ,
.

Formi
Properties | EvefKtf
i ActiveCortrar

^J

] Align
jalNone
; AlphaBlend i False '
AlphaBlencW<ik;255
Anchors
![akL.eft,akTop)
t AutoSctoS
| True
| AutoSrze
| False
r^iCMode'2 IbdLeftToRigh^.

BcrdetlctM'is


Caption
: All shown
. 13.4.

, , . (. 13.4) . , Properties (), , .



, . , Events (), ,
.

284

13

, , , .
, . .
,
. (. .
), , , ,
View. (
), Object Pascal.
Delphi ,
Windows.
, , , Delphi , .

13.2. Delphi
, Delphi
, , , . ,
, ,
,
.
, .
, ,
, . .
, .
, .

, , . ,
, ,
.
Projects (,
:):
CVProgram FilesYBorlandYDelphi. , .

Delphi

285

, .
File ()
Save as ( ). SaveUnitlas ( 1) (. 13.5).
Projects. Projects,
. ,
,
" ". , " ".
ISave Umti As
: r ^ i Projects
IBpl

:
:

| Delphi unit (" pas)

. 13.5.

, , . . . - . ,
First (- "").
,
<Delete>, " ", , <Enter>. ,
. ,
. ,
Unitl,
. - (, -

286

13

), , .
Projectl,
.
File Save Project
as.
( First)
.
. 13.6. .
,
. Save all File,
.

ISaveProjecM As

?|x||
...

' :.. [ i

|st

J j

d=]| ] 1
I

:
1 :

]
Delphi project (".dpi)

^J

. 13.6.

.
.
, , . :
;
, ;
,
;

Delphi

287

;
,
;
, ;
.
, , , , .
, . , , , .
, Object Pascal
, procedure, begin, a
end,
. , . .
.
, , . , File | Save
all. , , , , . " " , .
,
, . . , Object Pascal. , . . . .
, ,
(. .
) .
, Delphi, : " ",

.

288

13

.
.
. .

.
. , , .
, , ( ,
) Standard,
. , - Label. I
,
. Labeii.
(
) .
" ". , , . ,
. . . , ,
. .
.
.

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

Delphi

289

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

, .
, .
, ,
. ,
Label 1. ,
.
, Formi. , ,
, , ,
, . -
, .
, ,
, Properties ().

. .
,
,
. caption, . . , .
caption Labeii, ,
( ,
).
,
Labeii.
. , . , , ,
<Backspace>, ,
, <Delete>. . 1068

290

13

, ,
" ".
, .
Labell , . .
. ,
Name (). , ( ), . ,
, . Name, , -
Labell.
.
, , , . .
, , Font
(). ,
.
, , . , , , . .
.
,
, Font . , , , ,
caption.
.
Font, ,
. , .
, , ,
.
. 13.7. , Microsoft Word Windows.
, Delphi .
. -, 8 ( ) 12. -,

Delphi

291


-.
. , MS Sans Serif Arial,
Times New Roman . , , () . , ,
, . , ,

. , , .
, , .

;'

8
MS Serif
MT Extra
MTBWidgets
1
News Gothic MT
1
OCR A Extended
1
SkaskaForSerge
1
1

"
*
j

Pi

12
14
18
24

: \

:
,|

. 13.7.

, ,
. , , . . , Windows, [xj, . ,
( ). ,

13

292

Standard . Button .
. Buttoni.
, . , Label 1, Caption ( ).
" ".
, , , Font, , .
, "" . . ,
. 13.8.
7-Foimi

. 13.8. Delphi

, <Enter>,
.
, .
, , . - close,

293

Delphi

"". ,
. ,
.
Buttoni
Events (). , , (- "click").
, , onclick. , onclick,
, . begin end close.
. 13.9.
1 Unit! pas
b\

Uniti

TFotml

.+) C!J Variables/Constants


Q2 Uses

jprocedure TForrol.ButtonlClicte[Sender: TObje


Ibegin
jclose
Jend;

1 end.

13: 1

Jnsert

. 13.9. Delphi

Buttoniciick,
:
procedure TForml.Buttoniciick(Sender: TObject);
begin
close;
end;

,
. -

294

13

, ,
. .
.
Run. , , Run, .
. <F9>.
.

.

:
. , ,
, . : , .
Delphi.
, ,
. ,
.
. , , Buttonl, a
Button2. , , " ". .
.
. 13.10.
, , Button2. . " " "
..." (
). Caption.
- , :
. .

Delphi

295

Labell. Caption.
. , .
, , . , ,
, :
Labell.Caption:='

...'

'"'..'.:'::'.'.:.'.

\ - : ' i : ' : : - : ' : " ' : - : - :

::.:;';:':;

: : : : ' : : '

" : -

: ' " ' Y ^ '

' . ' : :

: "

. : "

. 13.10.

,
Button2, Events
Onclick.
Button2. Click .
: Labell , ,
. - ,
. .
, . , . 13.1 ,
.

296

13

| 13.1. Delphi
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, -StdCtrls;
type
TForml = class(TForm)
Labell: TLabel;
Buttonl: TButton;
Button2: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
( Public declarations }
end;

Forml: TForml;
implementation
{$R *.dfm)
procedure TForml.ButtonlClick(Sender: TObject);
begin
close;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Labell.Caption:=' .. 1 ;
end;
end.

, , -

Delphi

297

.
.
. , Save all.
. 13.11. ,
, , .
, . File Exit.
,
,
, . Cancel, , .

. 13.11.

,
.
, , Delphi,
( Delphi ", ) -

298

13

.
.

13.3. ""
, Delphi, , , .
, . , .
, , . C:\Program Files\Borland\Delphi\Projects Redaktor ,
.
,
.
:
. ,
.

;
. ;
. .
;
, .
.
, ,
, .
, . Formi, . . .
Properties () Caption.
, . Caption
Formi . , .

Delphi

299

.
. , Properties ()
Formi Color. , .

. ciSkyBlue (-).
1,
, Color
(). .
, , .
Label, Label 1.
,
Caption : , . Font
. - ,
(, -)
14 .
. Label2.
.
.
, ,
, ,
. Caption .
( ), , Labeli (, 12 ).
Label2 ,
.
Edit,
, Label (
Edit , ). Edit
|.
Editl.
. caption,
Text.
Editl, . , . ,

300

13


. , " " Font , .
,
10.
,
,
. ,
, . , <Delete> <Backspace>. ,
< > < > <Shift> <Delete>.
<> <End>.
. Delphi.

, . Button.
Buttonl.
.
, .
Caption. Buttonl : . Font
Buttonl , 10 .
,
, .
,
"", .
-,
Button2. Caption .
10 . . 13.12.
,
.
Button2 Events () onclick
, close.
. -

Delphi

301

::: , :

. 13.12. ""

,
Buttoni, , .
, , . . caption.
Labeii. Caption , . , . Editi,
Text. :
Editl.Text. :
Labell.Caption:=Editl.Text;

,
Buttoni, , Events () onclick,
. Buttoniciick
:
procedure TForml.ButtonlClick(Sender: TObject);
begin
Labell.Caption:=Editl.Text;
end;

302

13

. 13.2 .
[ 13.2. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForml = class(TForm)
Label1: TLabel;
Label2: TLabel;
Editl: TEdit;
Buttonl: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
begin
Labell.Caption:=Editl.Text;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close;
end;
end.

303

Delphi

.
, .
, ,
(. 13.13).
"

Delphi

1 Delphi

. 13.13. ""


.
, .
,
.

13.4. ""
Delphi ,
.
, .
, ,
( ).
,
, -

304

13

. , , .

,
- , , . . ,
, "".
Formi ( ) caption
,
.
( Labell) :
. caption,
Labell.
, .
.
, .
Standard. RadioGroup [. ,
.
, . , ,
.
RadioGroupi.
. Caption RadioGroupi.
, , , caption , . .
.
,
.
Standard RadioButton. .
RadioGroupi.
RadioButtoni . 7 , , RadioButton2

Delphi

305

RadioButton8. , RadioGroupi .
RadioButton. RadioButtonl.
,
, . , , . RadioButtonl
Align ().
. taRightJustify,
, .
.
taLeftJustify, , . [*| , taLeftJustify. ,
.
, ,
.
Caption RadioButton.
RadioButtonl Caption RadioButtonl ,
RadioButton2 Caption ,
RadioButton3 , RadioButton4 , RadioButton5
, RadioButton6 , RadioButton7
RadioButton8 - .
, , . ,
. ,
, ,
.
Panel (), Standard . , Paneii, .
Panell. -,
. . , Panell .

306

13

Properties () caption
. , .
,
. , , .
( Bevelwidth) 1 . , . , .
, Beveiouter. .
BvNone BvLowered. , "" .
.
Additional image. image \wm.
, imagei.

,
.
, , , , . imagei Panel 1. imagei
( Properties).
( "").
,
. 2, . .
, .
Left ( ""), . Left , 2.
, "" , . ,
4 ,
, .
.
,

Delphi

307

,
. :
Size: 193*185
Size - "", , . ,
.
189, 181. imagei
width () 189, Height () 181.
, , , , . stretch ().
: false true.
true,
.
, ,
. :
, - , , Microsoft Office,
, Paint,
Windows. Clipart,
Microsoft Office 97.
Microsoft Office ,
Windows.
,
imagei Picture (). None (),
-.
, Picture Editor ( ).
, Load (), Load picture ( ). ()
. , . |23]

13

308

( ). ,
,
. , . , , , . ,
. ,
Microsoft Office (
:).
Program Files, Microsoft Office.

. 13.14.

Microsoft
Office, . Microsoft
Office 97 . Microsoft
Office Clipart. Clipart
Popular, .
,
wmf. ,
, . ( ). ,
1 /
11| ( ). ,

Delphi

309

.
.
Arrows4.wmf. , , . . (. 13.15).
.
wmf imagel.

:
[*) Agree

* ] Amproble
jAmviclor

UlMfjj'l

^Bandaid

Sj) Amconfus

jw] Arrows5

1*] Beaitrap

i]Anndisasl

] Amwin

1*1 Attows6

Bomb

^Amhappy

]Anows1

[]Arrows7

Brick

S]Amidea

] Airows2

Arrows8

Ijjj] Building

] Amotgani

]Arrows3

Anowsgn

@Car

i\

2J

" r. 1

JArrows4

1 : ] All (". jpg;". jpeg;". bmp;". ico;". emf;". wmf)

. 13.15. Load Picture

Microsoft Office,
, , ,
. , Microsoft Office XP
Microsoft Office media, media cagcatlO, . .

.

. (Buttonl) , (Button2) .
Labei2.
,
. . 13.16.
,

13

310

"

..

. 13.16. ""

, ,
, . ,
, . - Delphi
RadioButtonClick. , . ,
, RadioButtoniciick.
.
, . . Form. Color.
Form. Color
, .
cl
( color). ,
, :
Forml.Color:=clRed;
:
procedure TForml.RadioButtoniciick(Sender: TObject);
begin
Forml.Color:=clRed;
end;

Delphi

311

- () ,
:
Forral.Color:=clime;


. ,
, ,
(Buttoni Button2).
. , Object Pascal, 13.3.
| 13.3. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForral - class(TForm)
Label1: TLabel;
RadioGroupl: TRadioGroup;
RadioButtonl: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
RadioButton7: TRadioButton;
RadioButton8: TRadioButton;
Panell: TPanel;
Imagel: TImage;
Buttoni: TButton;
Button2: TButton;
Label2: TLabel;
procedure RadioButtonlClick(Sender:

TObject);

procedure ButtonlClickfSender: TObject);


procedure RadioButton2Click(Sender:

TObject);

procedure RadioButton3Click(Sender:

TObject);

procedure RadioButton4Click(Sender:

TObject);

312

13
procedure
procedure
procedure
procedure
procedure

RadioButton5Click(Sender: TObject);
RadioButton6Click(Sender: TObject);
RadioButton7Click(Sender: TObject);
RadioButton8Click(Sender: TObject);
Button2Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.RadioButtonlClick(Sender: TObject);
begin
Forml.Color:-clRed;
end;
procedure TForml.RadioButton2Click(Sender: TObject);
begin
Forml.Color:=clLime;
end;
procedure TForml.RadioButton3Click(Sender: TObject);
begin
Forml.Color:=clBlue;
end;
procedure TForml.RadioButton4Click(Sender: TObject);
begin
Forml.Color:=clTeal;
end;
procedure TForml.RadioButton5Click(Sender: TObject);
begin
Forml.Color:=clYellow;
end;

Delphi
procedure TForml.RadioButton6Click(Sender: TObject);
begin
Forml.Color:=clFuchsia;
end;
procedure TForml.RadioButton7Click(Sender: TObject);
begin
Forml.Color:=clGreen;
end;
procedure TForml.RadioButton8Click(Sender: TObject);
begin
Forml.Color:=clAqua;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
close;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Label2.Visible:=True;
end;
end.

. 13.17. ""

313

314

13

. Red ,
Lime , Blue , Teal , Fuchsia , Yellow , Green -, Aqua .
. 13.17.


"".
.
, .
,
.
(, ),
.
.
. shape,
. shape Additional . ,
, shape, , , , , .
. , Brush. :
Color , style . shape ,
. , color
( ), style ( ), width ( ).
shape stcircie
( shape ).

Pen.Color. shape
- , . Brush.color.
(. .
shape) (cisiiver). ,
.

1 4


Delphi
, Delphi,
( , First)
( "", Redaktor). ,
, , ( "" "").

.

14.1. ""
, ,
:
( )
. .

Object Pascal. Object Pascal ,
Turbo Pascal, . Turbo Pascal, . .
. Object Pascal , Turbo
Pascal.
, Turbo Pascal, , , ,

316

14

var. ,
. , , :
[Error] (Jnitl.pas (37) : Undeclared i d e n t i f i e r : 'x'
[Fatal Error] P r o j e c t l . d p r ( 5 ) : Could not compile used u n i t ' U n i t l . p a s '

, (
37), , ( ). ,
, . . - .
Turbo Pascal, , Object Pascal,
. ,
, ,
. ,
, . . , ,
,
. .
,
, .
, , Turbo Pascal, ,
, . .
. , ,
, , .
, , ,
Object Pascal. strtoint.
Str string (), a Int integer
(). ,
" ".
, .
Object Pascal ,

Delphi

317

, . :
x:=StrtoInt(t);

t ,
.
- , Text Edit. , , , .
Editi :
x:=StrtoInt(Editl.Text) ;


,
: , . m t t o s t r .
, ,
strtoint. .
. ,
inttostr, , , Caption Label Text Edit.
(, )
Edit2, , , :
Edit2.Text:=InttoStr(z) ;

, ,
,
. , .
. ( caption Formi).
.
, ,
, Color, , - ciMoneyGreen, . . . ,
( 5 , - -).

14

318

,
. -, ,
. -,
, , . . . Editi, Edit2 Edit3.
Text,
.
,
, .
Labe.ii, Labei2 Labei3.
, . .
.
10, .
caption.
,
.

. Buttonl
, Button2 . ,
caption ( ). , . . 14.1.
1 J

; ~-_-'

: : '

'.'..'..'..

J-

'.

. 14.1. ""

j:::::.:

.,..'.'.

Delphi

319

. , ,
. el, e2 (
Editi, Edit2 Edit3). Buttoni. TForml.Buttoniciick.
. , ,
, , Buttoni, Events ()
Onclick. :
var el,e2,e3:integer;

TForml.ButtonlClick.

el 2 ,
Editl Edit2. , , el 2,
Object Pascal inttostr. :
el:=StrtoInt(Editl.text);
e2:=StrtoInt(Edit2.text) ;

:
e3:=el+e2;

, ,
Edit3. :
Edit3.Text:=InttoStr(e3)


end, ,
(, ,
). , , :
procedure TForml.ButtonlClick(Sender: TObject);
var el,e2,e3:integer;
begin
el:=strtoint(Editl.text);

320

14

e2:=strtoint(Edit2.text) ;
e3:=el+e2;
Edit3.Text:=InttoStr (e3)
end;

, begin end . .
Button2Ciick,
Button2. , ,
close. . 14.1
.
14.1. ,
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForml = class(TForm)
Labell: TLabel;
Label2: TLabel;
Editl: TEdit;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Buttonl: TButton;
Button2: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation

Delphi

321

{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var el,e2,e3:integer;
begin
el:=strtoint(Editl.text);
e2:=strtoint(Edit2.text);
e3:=el+e2;
Edit3.Text:=InttoStr(e3)
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;
end.

,
<>, .
,
,
.
. 14.2.
.J_n|x|

#f*

333

555

| |

888

. 14.2. ""
I 1068

322

14

14.2. ""
, Delphi,
,
, , .
, , . .
,
.
, , . .

.
,
.
, , ,
-. . . ,
, . Editl, Edit2 Edit3.
Edit4 , Edits
. , Text .
,
. , Labell Labels. ,
, , .
, Caption,
.
, : Buttonl Button2.

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

Delphi

323

Panell ,
. - Panell imagei,
.
"" , .
.
Paint, . .
. ,
" 1". Paint
Windows, ,
, , , . , .
.

. ,
Paint.
imagei panel 1.
imagei , Panell 4 , (
). . imagei Picture, .
, . 14.3.
, .
,
OnClick Buttonl TForml.ButtonlClick.
, , ,
, , s
v . :
var a,b,,s,v:integer;

( begin) , ,
. ,
inttostr, :

324

14

a:=strtoint(Editl.Text) ;
b:=strtoint(Edit2.Text);
c:=strtoint(Edit3.Text);

_|]|

(Jfo


-7

..;:;:

'

'

'

_ _ _ _ _ _ _

"7

- j

. 14.3. ""

, v, , Edit4.
v:=a*b*c;
Edit4.Text:=inttostr(v);

, .
, ,
, , , .
, . s
, Edits. :
s:=2*a*b+2*a*c+2*b*c;
Edit5.Text:=inttostr(s)

Delphi

325

TFormi.Buttonlciick :
procedure TFormi.Buttonlciick(Sender:
var a,b,,s,v:integer;
begin

TObject);

a:=strtoint(Editl.Text);
b:=strtoint(Edit2.Text);
c:=strtoint(Edit3.Text);
v:=a*b*c;
Edit4.Text:=inttostr(v);
s:=2*a*b+2*a*c+2*b*c;
Edit5.Text:=inttostr(s)
end;

, , close, TFormi.Button2ciick,
Button2. 14.2
.

; " "

.........

| 14.2. ,
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Label1: TLabel;
Label2: TLabel;
Editl: TEdit;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
Label5: TLabel;
Edit5: TEdit;
Buttonl: TButton;
Button2: TButton;
Panell: TPanel;
Imagel: TImage;

326

14
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);

private
( Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var a,b,c,s,v:integer;
begin
a:=StrtoInt(Editl.Text) ;
b:=StrtoInt(Edit2.Text);
c:=StrtoInt(Edit3.Text);
v:=a*b*c;
s:=2*(a*b+a*c+b*c);
Edit4.Text:=InttoStr(v);
Edit5.Text:=InttoStr(s);
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;
end.

.
: .
. 14.4.

14.3. ""
, ,
. , , . ,

327

Delphi

|15

)2

1792

. 14.4. ""

. .
.
, , , Object
Pascal.
,
Turbo Pascal. , ,
div mod.
,
.
:
. ,
.
;

. , .

328

14

. ;
. . .
;
, , ( );
, .
.
. Caption
. .
color
- ciAqua.
.
Editi (
) Edit2 ( ).
,
, Font . -, 10 , .
Label 1, , . Labei2
Labei3, , . Labei2 , a Labei3
.
12 .

.
Edit3 Edit4 Label4, Labels Label6.
.
.
Edits Edit6, .
: .

, .

Delphi

329

:
. , , , Labei7
Labels. ,
: Labei9 Labeiio,
.
.

. panel 1, imagel. ( imagel) ( Paneii). ,
"". : , .
Clipart, Microsoft Office 97, Clock.wmf,
, imagel
.
,
, . Buttoni
.
Button2 .
.
,
: Label 11 Labell2,
. ,
Labein Labeil2,
, visible False.
.
Button3 , .
. 14.5.
.
, Buttoni.
,
, . , var. -,

330

14

. cl, ml.
2 2. , strtoint, . , ,
Editi, Edit2, Edit3 Edit4, , :
cl:=StrtoInt(Editl.Text);
ml:=StrtoInt(Edit2.Text);
c2:=StrtoInt(Edit3.Text);
m2:=StrtoInt(Edit4.Text);

B>

; ;
;

I :


;';..


..
:
I::

. 14.5. ""

. . 60
. , , t l .
, t2. :
tl:=cl*60+ml;
t2:=c2*60+m2;

Delphi

331

t3 , , :
t3:=t2-tl;
, . ,
. , , , . . t3
60 div. .

mod, , , .
60. , , ,
:
c3:=t3 div 60;
m3:=t3 mod 60;
, ,
Edits Edit6. ,
, ,
inttostr. , ,
:
Edit5.Text:=InttoStr(c3);
Edit6.Text:=InttoStr(m3);
TFormi.Buttonciick,
,
:
procedure TForml.ButtonlClick(Sender: TObject);
var cl,ml,c2,m2,c3fm3,tl,t2,t3:integer;
begin
cl:=StrtoInt(Editl.Text);
ml:=StrtoInt(Edit2.Text);
c2:=StrtoInt(Edit3.Text);
m2:=StrtoInt(Edit4.Text);
tl:=cl*60+ml;
t2:=c2*60+m2;
t3:=t2-tl;
c3:=t3 div 60;
m3:=t3 mod 60;
Edit5.Text:=InttoStr(c3);
Edit6.Text:=InttoStr(m3);
end;

332

14

, Button2
. , ,
,
. ,
Labeln Labeii2. , ,
visible True (
False). , , , :
procedure TForml.Button2Click(Sender: TObject);
begin
Labell1.Visible:=True;
Labell2.Visible:=True
end;

, , , . :
procedure TForml.Button3Click(Sender: TObject);
begin
Close

end;
14.3.
| 14.3. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Editl: TEdit;
Edit2: TEdit;
Labell: TLabel;
Label2: TLabel;
Label3: TLabel;

Delphi
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Label9: TLabel;
LabellO: TLabel;
Buttonl: TButton;
Panell: TPanel;
Image1: T Image;
Button2: TButton;
Labelll: TLabel;
Label12: TLabel;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
imp1ementation
($R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var cl,ml,c2,m2,c3,m3,tl,t2,t3:integer;
begin
cl:=StrtoInt(Editl.Text);
ml:=StrtoInt(Edit2.Text);
c2:=StrtoInt(Edit3.Text);
m2:=StrtoInt(Edit4.Text);
tl:=cl*60+ml;
t2:=c2*60+m2;
t3:=t2-tl;
c3:=t3 div 60;

333

334

14

m3:=t3 mod 60;


Edit5.Text:=InttoStr() ;
Edit6.Text:=InttoStr (m3) ;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Labelll.Visible:=True;
Labell2.Visible:=True
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Close
end;
end.

,
, .
,
.
, , . 14.6.
i 11

I *{
.

'

' -


" (

|| j |

"*
|

. 14.6. ""

Delphi

335

14.4. ""
, . , . ,
.
. , ,
, . . , , , .
,

. :
( ) ;
( )
;
,
, ;
. .
.
;
, .
,

,
. , ,

.
,
caption Formi, . Editi Edit2, .
Label 1 Labei2 -

336

14

. Edit3 Edit4,
. Edit3 , Edit4 . Label3 Labei4
.
: Buttonl, Button2 Button3.
Buttonl
, Editl
Edit2, Edit3 Edlt4.
Button2 ,
. Button3
, .
Paneii,
imagei, . . ,
. , ,
Paint ,
"", .
(. 17.7).
, . ,
, , , ,
.
.
Real,
Turbo Pascal. .
Object Pascal
strtoFioat. Fioattostr. .

Buttonl. . h,
. : v, s.

Tfomi.Buttoniciick :
var h,r:integer; v,s:real;

Delphi

337

. . ,
.
,
( ) ,
Editi Edit2 .
:
h:=StrtoInt(Editl.Text);
:=StrtoInt(Edit2.Text);

j l '
-

. 14.7. ""

. , , . , , , .

sqr, Object Pascal.
pi, Object Pascal.
,
.
, :
pi*sqr(r). , Object Pascal :
v:=pi*sqr(r)*h;

14

338

, ,
. :
,
,
. , ,
pi*sqr(r), 2*pi*sqr(r).
-: 2*pi*r*r.
. 2*pi*r,
2*pi*r*h. ,
2*pi*r*r+2*pi*r*h. , : 2*pi*r* (h+r). s:
s:=2*pi*r*(h+r);

, Edit3 Edit4,
Fioattostr. :
Edit3.Text:=FloattoStr(v);
Edit4.Text:=FloattoStr(s)

, , Buttonl, :
procedure TForml.ButtonlClick(Sender:
var h,r:integer; v , s : r e a l ;
begin

TObject);

h:=StrtoInt(Editl.Text);
r:=StrtoInt(Edit2.Text);
v:=pi*sqr(r)*h;
s:=2*pi*r*(h+r);
Edit3.Text:=FloattoStr(v);
Edit4.Text:=FloattoStr(s)
end;

, , Button2.
, . ,
, .

Delphi

339


:
1. .
. File,
File New. , , ( 5
New ). Form.
. Form2.
2. . ( , , uniti) , , , :
FormN.Show;

N .
:
Form2.Show;

, ,
. , . show , .
, ,
:
procedure TForml.Button2Click(Sender: TObject);
begin
Form2.Show;
end;

3. .
, :
View. Forms.
, , .
, . . . ,
.
.

340

14


, , .
4. , ,
.
unit2. ,
View ,
Units. ,
( Unit2).
, , unit2
uniti. :
.
uses, . unit2.
:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Menus, Unit2;

.
Button3, , .
close, , ,
:
procedure TForml.Button3Click(Sender: TObject);
begin
Close
end;

uniti
.
14.4.
! 14.4. "" ( )
unit Uniti;
interface

Delphi

341

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Menus, Unit2;
type
TForml = class(TForm)
Label1: TLabel;
Editl: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
Buttonl: TButton;
Button2: TButton;
Button3: TButton;
Panel1: TPanel;
Imagel: TImage;
procedure ButtonlClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender:
var h,r:integer; v,s:real;
begin
h:=StrtoInt(Editl.Text);
r:=StrtoInt(Edit2.Text);
v:=pi*sqr(r)*h;
s:=2*pi*r*(h+r);
Edit3.Text:=FloattoStr(v);
Edit4.Text:=FloattoStr(s)
end;

TObject);

342

14

procedure TForml.Button2Click(Sender: TObject);


begin
Form2.Show;
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Close
end;
end.


. Form2, Caption
. ,
: Labeii Labei2 Buttoni. , Buttoni. ,
close. Unit2 14.5.

'

"

"

"

14.5. "" ( )
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Buttoni: TButton;
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

343

Delphi
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.ButtonlClick(Sender: TObject);
begin
Close
end;
end.


. . 14.8.
i f
V

||

1---

__

__

., 1

. 14.8. ""


Delphi "", Turbo Pascal, 3. : , , .

344

14

4
1000, 500, 100 50 ,
, .
. . Money.wmf
Clipart, Microsoft Office 97.

15


Delphi
, Delphi, , . ,
. . ,
. .
, , .

15.1. ""
Object Pascal, Turbo Pascal,
. if
Turbo Pascal. Object Pascal
, .
if Object Pascal. -, . 4 ,
(. 4.4). ,
Delphi.
""
: -, ,
, . -,
, . , , -

346

15

, . , . , .
,
,
.

: , , ,
.

, .

. .
-.
. Memol
.
Memo, Standard ().
,
Label , . ,
Memo Lines -.
String List
Editor, " ". , <Enter>. . ,
,
color Memo Color Form. Borderstyle ( ) Memo
bsNone ( ).

? , (
Font) 12.
Editl. . 12.
Editl 2, -

Delphi

347

, . . , 9. -.
Editi Buttoni.
, 12. Labeii, .
. ,
12.
, . . , .
visible False. . :
Caption Labeii .
, .
.
, paneii,
imagel, . . . , - , .
Web- JPEG. , , , , ,
.
Button2 Button3.
, Buttoni. : Button2 Button3.
Button2 Form2.

.
,
, , . .
.
,
Height width.
, -

15

348

, Memol, , Buttoni, .
, , 10,
, 12. , . 15.1.



""

. 15.1. ""

.
. , Buttoni.
. strtoint. Editi :
k:=StrtoInt(Editl.Text) ;

, ,
1957 (
). , , . if:
if k=1957
then Labell.Caption:='Bbi '
else Labell.Caption:='Bbi '

Delphi

349

, ,
, :
procedure TForml.ButtonlClickfSender: TObject);
var k:integer;:
begin
k:=StrtoInt(Editl.Text);
if k=1957
then Labell.Caption:='Bbi 1
else Labell.Caption:='Bbi '
end;

, ,
Button2. , ,
:
Form2.Show;

, uses,
, , Form2:
uses Unit2;

, Button3,
:
Close;


unitl, 15.1.
i 15.1. "" ( )
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForml =
Memol:
Memo2:
Editl:

class(TForm)
TMemo;
TMemo ;
TEdit;

350

15
Buttonl: TButton;
Labell: TLabel;
Panell: TPanel;
Image1: Tlmage;
Button2: TButton;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);


private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
uses Unit2;
{$R *..dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var :integer;
begin
k:=StrtoInt(Editl.Text) ;
if k=1957
then Labell.Caption:=' '
else Labell.Caption:='Bbi

end;
procedure TForml.Button2Click(Sender: TObject);
begin
Form2.Show
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Close
end;
end.

, , Buttonl,

351

Delphi

Form2.
Unit2 TForm2.Buttoniciick close.
Unit2 , . .
(. 14.5). "" . 15.2.

J1957

I
""

. 15.2. ""

15.2. " "


, ,
if . ,
- , .
Object Pascal
. Turbo Pascal, Object Pascal begin end.

then, else,
. , .
:
ax2

352

15

, ,
.
. ,
:
d=b2-4ac.

.
, \
2 (
). :
*1

;
2
.
2
2
, ,
. ,
if.
, .
, . , , . ,
. (, ,
). .

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

Delphi

353

, ,
, , .
, .

.
. :
.
, , , ,
.

, -. , (
), . Delphi
.
,
. .
Forml .
, , -.

.
Editi, Edit2 Edit3.
Labell, Label2 Label3. Editl . Text ,
. . .
( Font) ,
10 .
Edit2 Edit3, .
Labell . -,
( Caption) :
. -, . 10 .
Label2 Label3. Label2 , Label3 .
12 3. 1068

354

15


Edit4 Edits, xi 2.

, . . Text, 10 .
, , , .
, , , .
- . : , ,
, ,
. , Edit4 Edits visible
False (), . .
Label4 ( , ).

, , visible False.
,
10 . , .
: Buttonl Button2. Buttoni ,
: .
, .
12 .
Button2.
: .
, , . ,
, Panel 1, imagel, . . . ,
Microsoft Office 97.
: ,
, Program Files\Clipart\Popular.
Amconfus wmf. -

Delphi

355

, , ,

.
, , .
, .
, . ,
.
, ( Object Tree View), , . ,
, , ,
MainMenui ( ). "",
, .
"" "". "", , "" "".
, ,
. . 15.3 ,
, .
fobiect TieeView

L-fl
Buttoni

: | Button2

Editi
Edit2
Edit3
Edi!4
Edit5
Labeli
Label2
Labels
Label4
MainMenui
Y *>** {1}
' $ {N3}
& 4: {N2}
$. {N4}
Panel!

3
a

\....ra
a
H

i-I
\
i :

km

. 15.3. , MainMenui P k n e l l
( MainMenui )

15

356

:
Standard MainMenu,
: _. ,
,
, . . . I "^ I

\ \
( ), Form I.MainMenu 1 (. 15.4). .

W Formi-MainMenui
I

. 15.4. : )
; 6)

,
caption, (, ) <Enter>.

Delphi

357


Forml.MainMenul, ,
. ,
, NI.
.
. , Caption,
( )
N2.
.
,
, . Caption, . ,
. , ,
.
.
N4. Forml.MainMenul, " " . , , ,
. . 15.5.
1 Jf

L
. 15.5.

358

15

( Buttonl). TForml.Buttonlciick.
, . , ,
d xl 2. , real:
var a,b,c,d,xl,x2:real;


.
StrtoFloat:
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=StrtoFloat(Edit3.Text);


:
d:=sqr(b)-4*a*c;

. , :
1. .
2. Edit4 Edits, .
3.
Fioattostr , .
4. , ,
.

:
xl:=(-b-sqrt(d))/{2*a);
x2:=(-b+sqrt(d))/(2*);
Edit4.Text:= FloattoStr (xl);
Edit4.Visible:=True;

Delphi

359

Edit5.Text:=FloattoStr(x2);
Edit5.Visible:=True;
Label4.Visible:=True;
Label4.Caption:='KopHM

'

, , :
1. , ,
.
2. , . .
.
:
Label4.Visible:=True;
Label4.Caption:='ypaBHeHMe ';
Edit4.Visible:=False;
Edit5.Visible:=False

:
if d>=0
then
begin
xl:=(-b-sqrt(d))/(2*a);
x2:=(-b+sqrt(d))/(2*a);
Edit4.Text:=FloattoStr(xl);
Edit4.Visible:=True;
Edit5.Text:=FloattoStr(x2);
Edit5.Visible:=True;
Label4.Visible:=True;
Label4.Caption:=' '
end
else
begin
Label4.Visible:=True;
Label4.Caption:=' ';
Edit4.Visible:=False;
Edit5.Visible:=False
end

:
procedure TForml.ButtonlClick(Sender:
var a,b,c,d,xl,x2:real;

TObject);

360

15

begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=StrtoFloat(Edit3.Text);
d:=sqr(b)-4*a*c;
if d>=0
then
begin
xl:=(-b-sqrt(d))/(2*a);
x2:=(-b+sqrt(d))/(2*a);
Edit4.Text:=FloattoStr(xl);
Edit4.Visible:=True,
Edit5.Text:=FloattoStr(x2);
Edit5.Visible:=True;
Label4.Visible:=True;
Labe14.Capt i on: =' '
end
else
begin
Label4.Visible:=True;
Label4.Caption:='

';

Edit4.Visible:=False;
Edit5.Visible:=False
end
end;

, ,
( Button2).
TFormi.Button2ciick :
1. , .
2.
.
Text
, .
visible False. :
procedure TForml.Button2Click(Sender:
begin
Editl.Text:='';
Edit2.Text: = " ;
Edit3.Text:='';

TObject);

Delphi

361

Edit4.Visible:=False;
Edit5.Visible:=False;
Label4.Visible:=False
end;

,
. , , . . (, N3, ), Events ()
onclick.
,
, N3 TForml.N3ciick.
close, :
procedure TForml.N3Click(Sender: TObject);
begin
close
end;

, N4,
. , .
, . , , . . ,
, TForml.N4ciick :
procedure TForml.N4Click(Sender:
begin
Form2.Show
end;

TObject);

Unitl 15.2.
I 15.2. " " ( )
unit Unitl;
interface

362

15

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Menus;
type
TForml - class(TForm)
Label1: TLabel;
Editl: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Panel1: TPanel;
Image1: TImage;
Buttonl: TButton;
Label4: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Button2: TButton;
MainMenul: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
procedure ButtonlClick(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
uses Unit2;
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var a,b,c,d,xl,x2:real;
begin
a:=StrtoFloat(Editl.Text);

Delphi
b:=StrtoFloat(Edit2.Text) ;
c:=StrtoFloat(Edit3.Text);
d:=sqr(b)-4*a*c;
if d>=0
then
begin
xl:=(-b-sqrt(d))/(2*a);
x2:=(-b+sqrt(d))/(2*a);
Edit4.Text:=FloattoStr(xl);
Edit4.Visible:=True;
Edit5.Text:=FloattoStr(x2);
Edit5.Visible:=True;
Labe14.Visible:=True;
Labe14.Capt ion: =' '
end
else
begin
Label4.Visible:=True;
Label4.Caption:=' 1;
Edit4.Visible:=False;
Edit5.Visible:=False
end
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Editl.Text:='';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Visible:=False;
Edit5.Visible:=False;
Label4.Visible:=False
end;
procedure TForml.N3Click(Sender: TObject);
begin
close
end;
procedure TForml.N4Click(Sender: TObject);
begin
Form2.Show
end;
end.

363

364

15
I if

I 1
I

. 15.6.

I {*



10

. 15.7.

Unit2, ,
, . ,

Delphi

365

.
.
. 15.615.7 , , ,
. . 15.6 , . 15.7 .

15.3. ""
, Delphi, , (, , )
. ,
.
.
Turbo Pascal. , Turbo Pascal, case.
, Delphi . , .
. , -, ,
-, , .
"" :
;
;
;
;
;
,
, (,
);

366

15

,
( , );
,
.
, :
, ;
,
( , "", , ).
. ( caption Formi) . -.
. . Editi Edit2 , Edit3 .
. Labell, Label2
Label3.

. Buttoni
, Button2 , Button3 , Button4 , Buttons
, Button6
. Button7,
, . . Buttons.
. Editi Labei4
Labels. (
visible False). , ( ,
Buttons ), . : " ".
Edit2 Label , . , -
Editi, Edit2
Button4 , ,
Label6 . Edit2
: " ".

Delphi

367

""
checkboxi. .
, ,
, .
,
.
, .
, .
, Edit3
. , Standard checkbox,
: .
, : 0 .
.
caption checkbox.

checkboxi : .
. checkbox,
Alignment . Alignment

.
taRightJustify, . . .
Alignment , taLeftJustify . , .
,
.
Tour98, Windows 98.
Panel.
imagel, . . .
imagel
. , chckbook,
GIF, Delphi . , - ,
.
Chckbook, Paint,

368

15

Windows, Paint . Paint BMP.


,
. , ,
Delphi.

imagel, Picture .
, , Panell imagel . , .
(. 15.8).
I

" ;;:.'

. 15.8. ""


Buttoni, ,
Editi Edit2. , Editl.Text Edit2.Text
. , . :
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=a+b;

Delphi

369

, Edit3.Text,
.
, "
", . . checkboxl.
checked. , checked
True, , False. if .
, , then, ,
else.
, then, . -,
okr round, ,
. -, okr
inttostr Edit3.
:
okr:=round();
Edit3.Text:=InttoStr(okr)

, else, Edit3.Text
FloattoStr:
Edit3.Text:=FloattoStr()

, ,
, :
procedure TForml.ButtonlClick(Sender: TObject);
var a,b,c:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=a+b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end

370
else
end;

15
Edit3.Text:=FloattoStr()

,
(Button2) (Button4).
(Button4)
. , , . , -
Edit2. ,
Button4 , Edit2.
Edit2.Text . . ,
, else.
Labei6, ,
. ,
then ,
, . ,
. , ,
. ,
. , , :
procedure TForml.Button4Click(Sender: TObject);
var a,b,c:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
if b<>0 then
begin
c:=a/b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end

Delphi

371

else
begin
Label6.Visible:=True;
Edit3.Text: = "
end
end;

, ,
(Buttons),
,
Editl.
, Editl,
, .
, , . .
. :
a:=StrtoFloat(Editl.Text);
Edit2.Text:='';

, .
, ,
then, . . ,
Edit3.Text. ( ), Label4 Labels, .
:
procedure TForml.Button5Click(Sender: TObject);
var ,:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text);
Edit2.Text:='';
if a>=0 then
begin
c:=sqrt (a) ;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end

372

15
else Edit3.Text:=FloattoStr()
end
else
begin
Edit3.Text: = ' ';
Label4.Visible:=True;
Label5.Visible:=True
end

end;

,
(Button6), , , . .
.
Button6 :
procedure TForml.Button6Click(Sender: TObject);
var ,:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text) ;
Edit2.Text:='
c:=sqr(a);
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end;

(Button7) , (Buttons)
, ,
, . . 15.3
"".
I 15.3. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;

Delphi
type
TForml = class(TForm)
Labell: TLabel;
Label2: TLabel;
Editl: TEdit;
Edit2: TEdit;
Buttonl: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Panel1: TPanel;
Button8: TButton;
Imagel: Tlmage;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
CheckBoxl: TCheckBox;
procedure ButtonlClick(Sender:
procedure Button2Click(Sender:
procedure Button3Click(Sender:
procedure Button4Click(Sender:
procedure Button5Click(Sender:
procedure Button6Click(Sender:
procedure Button7Click(Sender:
procedure Button8Click(Sender:
private
{ Private declarations }
public
{ Public declarations }
end;

373

TObject);
TObject);
TObject);
TObject);
TObject);
TObject);
TObject);
TObject);

var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var a,b,:real; okr:integer;

374

15

begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=a+b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else

Edit3.Text:=FloattoStr(c)

end;
procedure TForml.Button2Click(Sender: TObject);
var a,b,:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text) ;
b:=StrtoFloat(Edit2.Text) ;
:=a-b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end;
procedure TForml.Button3Click(Sender: TObject);
var a,b,c:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
c:=a*b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end;
procedure TForml.Button4Click(Sender: TObject);
var a,b,c:real; okr:integer;

Delphi
begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text);
if boO then
begin
c:=a/b;
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:-InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end
else
begin
Label6.Visible:=True;
Edit3.Text:='
end
end;
procedure TForml.Button5Click(Sender: TObject);
var ,:real; okr:integer;
begin
a:=StrtoFloat(Editl.Text);
Edit2.Text:='';
if a>=0 then
begin
c:=sqrt(a);
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end
else
begin
Edit3.Text: = '' ;
Label4.Visible:=True;
Label5.Visible:=True
end
end;

375

376

15

procedure TForml.Button6Click(Sender: TObject);


var a,c:real;

okr:integer;

begin
a:=StrtoFloat(Edit1.Text);
Edit2.Text: = " ;
c:=sqr(a);
if Checkboxl.Checked
then
begin
okr:=round(c);
Edit3.Text:=InttoStr(okr)
end
else Edit3.Text:=FloattoStr(c)
end;
procedure TForml.Button7Click(Sender: TObject);
begin
close
end;
procedure TForml.Button8Click(Sender: TObject);
begin
Editl.Text: = "
Edit2.Text:='
Edit3.Text:='
Label4.Visible:=False;
Label5.Visible:=False;
Label6.Visible:=False
end;
end.

. 15.9 "" , . 15.10 ,


(
). . 15.11
.

15.4.
""
Turbo Pascal, Object Pascal
if.. .then.. .else case. -

Delphi

377

"".
13 .
,
, . .
.

1105.08

{ ;

. 15.9. ""


33.5

0

[]

. 15.10. ""

378

15
*ff

. 15.11. ""

, , , ,
, . ,
. .
, , ,
. . -, Panei2,
imagei. , . , ,

, , . , , Clipart Office 97,
car.wmf.
. car.wmf Picture
imagei.
.

Delphi

379_

. , . . ,
.
.
, System, a
, :

. ,
Timerl.

, .
onTimer, . .
, .
, interval , .
, . . .
.
interval 3000 , 3 .
,
. Paneil, shape. shapel ,
shape2 , a shape3 .
Buttoni, .
Labell, : . .
. 15.12.
,
.
OnCreate.
:
, ,
, , ,
imagei 12 . FormCreate :
Shapel.Brush.Color:=clRed;
Panel2.Height:=64;
Imagei.Height:=60;

380

15

Panel2.Width:=233;
Imagel.Width:=229

, shape
Brush, , .
Brush.color,
ciRed ( ).
I

. 15.12. ""


Timeri. , TimeriTimer,
.
, :
if. 3 .
,
:
if Shapel.Brush.Color=clRed
then n:=l;
if Shape2.Brush.Color=clYellow
then n:=2;
if Shape3.Brush.Color=clLime
then n:=3;

Delphi

381

, (
, , ),
.
,
- .
, , .
, case:
Imagel.Picture.LoadFromFile('Stop.wmf');
Imagel.Height:=178;
Panel2.Height:=182;
Imagel ."Width.107;
Panel2.Width:=111;
Shapel.Brush.Color:=clSilver;
Shape2.Brush.Color:=clYellow;

, .
imagel Stop.wmf,
, .
.
Stop .
LoadFromFile ( ). ,
, . Panell imagel , .
- shapel ( ), Shape2 ( ) -
.
, , 3.
, Shape2 ,
( shape3) .
,
.
( ,
), ,
. , flag,
, .

382

15

,
flag , .
, flag , .
, . ,
.
Microsoft Office 2000 people.wmf, . ,
, Car.wmf. if
:
if

flag=l
then
begin
Shape2.Brush.Color:=clSilver;
Shapel.Brush.Color:=clRed;
Imagel.Picture.LoadFromFile('Car.wmf');
Panel2.Height:=64;
Imagel.Height:=60;
Panel2.Width:=233;
Imagel.Width:=229
end
else
begin
Imagel.Picture.LoadFromFile('People.wmf);
Panel2.Height:=137;
Imagel.Height:=133;
Panel2.Width:=152;
Imagel.Width:=148;
Shape2.Brush.Color:=clSilver ;
Shape 3. Brush. Color: =clHme
end;

,
imagel , ,
. , flag
,
interface. 15.4
"".

Delphi

383

! 154. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForml = class(TForm)
Panell: TPanel;
Label1: TLabel;
Buttonl: TButton;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Timerl: TTimer;
Panel2: TPanel;
Imagel: Tlmage;
Label2: TLabel;
procedure TimerlTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml; n:integer; flag:integer;
implementation
{$R
procedure TForml.FormCreate(Sender: TObject);
begin
Shapel.Brush.Color:=clRed;
Panel2.Height:=64;
Imagel.Height:=60;
Panel2.Width:=233;
Imagel.Width:=229
end;

384

15

procedure TForml.TimerlTimer(Sender: TObject) ;


begin
if Shapel.Brush.Color=clRed
then n:=l;
if Shape2.Brush.Color=clYellow
then n:=2;
if Shape3.Brush.Color=clLime
then n:=3;
case n of
1:begin
Image1.Picture.LoadFromFile('Stop.wmf');
Imagel.Height:=178;
Panel2.Height:=182;
Imagel.Width:=107 ;
Panel2 ..width: -111;
Shapel.Brush.Color:=clSilver;
Shape2.Brush.Color:=clYellow;
flag:=0
end;
2: begin
if flag-1
then
begin
Shape2.Brush.Color:=clSilver;
Shapel.Brush.Color:=clRed;
Imagel.Picture.LoadFromFile('Car.wmf') ;
Panel2.Height:=64;
Imagel.Height:=60;
Pane12.Width:=233 ;
Imagel.Width:=229
end
else
begin
Imagel.Picture.LoadFromFile('People.wmf');
Panel2.Height:=137;
Imagel.Height:=133;
Panel2.Width:=152;
Imagel.Width:=148;
Shape2.Brush.Color:=clSilver;
Shape3.Brush.Color:=clLime
end;
end;

Delphi

385

begin
Imagel.Picture.LoadFromFile('Stop.wmf']
Imagel.Height:=178;
Panel2.Height:=182;
Imagel.Width:=107;
Panel2.Width:=111;
Shape3.Brush.Color:=clSilver;
Shape2.Brush.Color:=clYellow;
flag:=l
end;
end;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
close
end;
end.
. 15.13 , , . 15.14
. 15.15 , .

. 15.13. "" .

. 1068

386

15

. 15.14. "" .

. 15.15. "" .


"", ,
. .
100, -

Delphi

387

, 4 (, 2004-), ,
4 (, 2005-). 100, ,
400 (, 2000-), , 400 (, 1900-).
.
( ) : ,
. ,
: , , :
,
. Paint . Image.

.
100. ,
.

1 6

Delphi
Object Pascal, Turbo Pascal, ,
,
.
Delphi .

16.1. ""
Object Pascal
.
Turbo Pascal. ,
, , .
Delphi. , faktor. ,
. :
, ;
, , ;
,
;
, ;
, ,
, ;

390

16

, , ,
.
. , . .
. , . ( NI) ( ), (
N2) ( N4). ,
.
.
.
()
-. Editi. Memoi.
, ,
. -, , Borderstyle None, . .
.
( Buttonl), .
( Edit2), , ( Labeii). .
( Button2) ( Button3).
.
Paneii,
( imagei).
Clipart, Microsoft Office 97.
Amidea. ,
.
. (. 16.1).

. N3 ,
close.
N4 Form2.show,
.

Delphi

391


File | New ( | ), Unit2 unitl, uses.


.
,
.

:::;:::::;

. 16.1. ""

,
, . , , ( , ),
, , . :
procedure TForml.ButtonlClick(Sender: TObject);
var i,f,n:integer;
begin
n:=StrtoInt(Editl.Text);
f:=l;
for i:=l to n do
f:=f*i;
Edit2.Text:=InttoStr{f)
end;

, , , . -

392

16

-
, . . . 16.1 .
| 16.1.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus,Unit2, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
MainMenul: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
Memol: TMemo;
Editl: TEdit;
Buttonl: TButton;
Label1: TLabel;
Edit2: TEdit;
Panel1: TPanel;
Image1: TImage;
Button2: TButton;
Button3: TButton;
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}

Delphi

393

procedure TForml.N3Click(Sender: TObject);


begin
close
end;
procedure TForml.N4Click(Sender: TObject);
begin
Form2.Show
end;
procedure TForml.ButtonlClick(Sender: TObject);
var i,f,n:integer;
begin
n:=StrtoInt(Editl.Text);
f:=l;
for i:=l to n do
f:=f*i;
Edit2.Text:-InttoStr(f)
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Editl.Text:=';
Edit2.Text:=''
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Close
end;
end.

Unit2, ,
. .

. 16.2. ,

15, . .
. , 12
479 001 600.

394

16

I if


.
,
.

720

. 16.2. ""

16.2. ""
, Delphi
, "". , , ,
,
, .
,
, (
, , , ) . , . ,
Delphi,
:
, ;
;
:
(), ();

Delphi

395

(
);
;
;
, .
, , . -
, .
Editl, Edit2 Edit3 .
,
Labell, Labei2 Labei3. : Buttonl Button2. , .
Edit4 Edits, . Edit4 , Edits . ,
Memol. ,
,
. Label4 Labels.

( Paneii imagei).
(Button3),
. (. 16.3).

(Buttonl). . :
srok , , rub
,
, ,
, i . : vki , pro , drob
drobl ,
.

(Editl) vki,

396

16

Edit2 srok,
Edit3
pro. :
vkl:=StrtoFloat(Editl.Text) ;
srok:=StrtoInt(Edit2.Text) ;
pro:=StrtoFloat(Edit3.Text);

: :.

'.'.'.'.'.'.'.'.. .......

;


:::;::::::::::::::::::::.:::::.::

' ] : : : : : : ;

:::::::::::::::;;


-
; : -

:".::::
.

16.3. ""

,
.
, , ,
100. . :
for i : = l to srok do
vkl:=vkl+vkl*pro/100 ;

.
trunc, ,
. -

Delphi

397

,
Edit:
rub:=trunc(vkl);
Edit4.Text:=InttoStr(rub);

drb, . drb ,
100 drbi. drbi, . , round,
. :
drb:=vkl-rub;
drbi:=drb*100;
kop:=round(drbi);

, Buttoni, :
procedure TForml.ButtonlClick(Sender:
var i,srok,rub,kop:integer;
vkl,pro,drb,drbi:real;
begin
vkl:=StrtoFloat(Editl.Text);
srok:=StrtoInt(Edit2.Text);
pro:=StrtoFloat(Edit3.Text);
for i:=l to srok do
vkl:=vkl+vkl*pro/100;
rub:=trune(vkl);
Edit4.Text:=InttoStr(rub);
drb:=vkl-rub;
drbl:=drb*100;
kop:=round(drbi);
Edit5.Text:=InttoStr(kop)
end;

TObject);

Button2,
, Button3, ,
, , .
16.2.

398
;

16

;:""'""

"

I 16.2. ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Panel1: TPanel;
Imagel: TImage;
Label1: TLabel;
Editl: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Memol: TMemo;
Buttonl: TButton;
Edit4: TEdit;
Button2: TButton;
Button3: TButton;
Label4: TLabel;
Edit5: TEdit;
Label5: TLabel;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var

i,srok,rub,kop:integer;
vkl,pro,drb,drbl:real;

Delphi

399

begin
vkl:=StrtoFloat(Editl.Text);
srok:=StrtoInt(Edit2.Text);
pro:=StrtoFloat(Edit3.Text);
for i:=l to srok do
vkl:=vkl+vkl*pro/100;
rub:=trunc(vkl);
Edit4.Text:=InttoStr(rub);
drb:=vkl-rub;
drbl:=drb*100;
kop:=round(drbl) ;
Edit5.Text:=InttoStr(kop)
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Editl.Text:-1';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
Edit5.Text:=''
end;
end.

, 5000
3 15%, . 16.4.

16.3.
" "
,

.
, 12 , ..
3 .

.

400

16

$:;&

5000

| _ jj



:
'604

^8

. 16.4. ""

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

;
;
;
.
Labeii,
: ?, ?,

Delphi

401

? ?. -

Labei2. . : 2+5, 8-6, 5*7


. .
"": 4 7.
Editi . Labei3.

Editi, , . (Buttonl).
, ,
, . , , , .
(Button2),
.
paneii, imagei,
. , ,
Study Works. StudyWorks
, Mathsoft
. , Clipart, Microsoft
Office, .
,
.
StudyWorks .
<Alt>+<PrintScreen> ( ).
Windows Paint.
| Paint
. | d | ()
Paint , . | . | Paint
| Paint . Paint |
Delphi kontrol.

16

402

, Paint
.
|
, , ,
Panell imagei . imagel , , Panel
4 . ,
. (. 16.5).

. 16.5. " "


. ,
, ,

, , . .
Forml Events ()
onCreate ( ).
OnCreate, FormCreate.
. -,
. ,

Delphi

403


,
. Turbo Pascal, Object Pascal Randomize. -, -. - . - t
, ,
.
, . .
. .
, . .
. t
, . . .
. , Turbo
Pascal, Random.
inttostr .
?, Labeii. Label2 ,
"+".
. :
procedure TForml.FormCreate(Sender: TObject);
begin
randomize;
k:=l; t : = 0 ;
x:=random(9)+1;
:=random(9)+1;
a:=InttoStr(x) ;
b:=InttoStr(y) ;
Labell.Caption:=' ?';
Label2.Caption:=a+'+'+b;
end;

. ,
, .
Buttoni onclick,
Buttonlciick. , ,
.

404

16

, . , .

( , , . .
). strtoFloat
"" . ,
,
t .

,
.
, ,
.
, , , . .
( ) . . setFocus,
, . , Editi Editi.SetFocus.

:
z:=x+y;
c:=StrtoFloat(Editl.Text) ;
if c=z then t:=t+l;
x:=random(9)+1;
:=random(9)+1;
a:=InttoStr(x);
b:=InttoStr(y) ;
Labell.Caption:='4eMy ?';
Label2.Caption:=a+'+'+b;
Label3.Caption:='BBeflMTe ';
k:=k+l;
Editl.Text:='';
Editl.SetFocus

, . -

Delphi

405

, 1 2. :
. , 1,
, , 2, . 3, , ,
, , .
. , ,
. ,
.
. :
if

k=3 then z:=x+y


else z:=x-y;
c:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+1;
:=random(9)+1;
a:=InttoStr(x) ;
b:=InttoStr(y);
Labell.Caption:='4eMy ?';
Label2.Caption:=a+'-'+b;
Label3.Caption:=' 1;
k:=k+l;
Editl.Text:='';
Editl.SetFocus

,
(
). ,
.
,
, , , . case, t -.
:
if c=z then t:=t+l;
Editl.Visible:=False;

406

16

Labell.Caption:='';
Label2.Caption:='';
Label3.Caption:='';
Buttonl.Visible:=False;
Label4.Visible:=True;
case t of
0..7: Label4.Caption:='
8,9:
Label4.Caption:='
10,11: Label4.Caption:='
12:
Label4.Caption: = 'Baiua

2';
3';
';
5';

end;

, ,
Buttonl.
, . ,
case . :
case k of
1..2:
begin
z:=+;
c:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+1;
:=random(9)+1;
a:=InttoStr(x);
b:=InttoStr(y);
Label1.Caption:=' ?';
Label2.Caption:=a+'+'+b,
Label3.Caption:='BBewiTe ';
k:=k+l;

Editl.Text:-1';
Editl.SetFocus
end;
3..5: begin
if k=3 then z:=x+y
else z:=x-y;
c:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+l;
:=random(9)+1;
a:=InttoStr(x);
b:=InttoStr(y);

Delphi
Label1.Caption:=' ?';
Label2.Caption:=a+'-'+b;
Label3.Caption:=' ';
k:=k+l;
Editl. Text:-";
Editl.S*tFocua
end;
6..8: begin
if k=6 then z:=x-y
else z:=x*y;
:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+1;
y:=random(9)+1;
a:=InttoStr(x);
b:=InttoStr(y);
Labell.Caption:='4eMy ?';
Label2.Caption:=a+'*'+b;
Label3.Caption:='BBeflMTe 1;
k:-k+l;
Editl.Text:='';
Editl.SetFocus
end;
9..11: begin
if k=9 then z:=x*y
else z:=(x+y)/2;
:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+l;
:=random(9)+1;
a:=InttoStr(x);
b:=InttoStr(y);
Labell.Caption:=' ?';
Label2.Caption:=a+' '+b;
Label3.Caption:=' ';
k:=k+l;
Editl.Text:='';
Editl.SetFocus
end;
12:
begin
if c=z then t:=t+l;
Editl.Visible:=False;
Labell.Caption:='';

407

16

408
Label2.Caption: = '' ;
Label3.Caption:='';
Buttonl.Visible:=False;
Label4.Visible:=True;
case t of
0..7:

Label4.Caption: = 'Bauia 2';

8,9:

Label4.Caption:=' 3';

10,11: Label4.Caption:=' 4';


12:

Label4.Caption:='Bama 5';

end;
end;
end;

, , , ,
. ,
, - ,
,
, , . 16.6.
Debuqqei Exception Notification
Project Ptoject1.exe raised exception class EConvertErroc with message "' i;
not a valid integer value'. Process stopped Use Step or Run to continue.

View CPU Window

|~;;;"1|

. 16.6. ,

(, , )

- , , , . ,
.
.
.
, , .
Editi .

Delphi

409

, , 0 9. , ,
"".
, ,
.
:
flag:=true;
s:=Editl.Text;
f o r i : = l t o l e n g t h ( s ) do
i f ( s [ i ] < > ' 0 ' ) and ( s [ i ] o ' l ' ) and ( s [ i ] < > ' 2 ' )
and ( s [ i ] O ' 3 ' ) a n d ( s [ i ] < > ' 3 ' ) and ( s [ i ] < > ' 4 ' )
and ( s [ i ] < > ' 5 ' ) and ( s [ i ] < > ' 6 ' ) and ( s [ i ] < > ' 7 ' )
and ( s [ i ] < > ' 8 ' ) and ( s [ i ] < > ' 9 ' ) and ( s [ i ] < > ' - ' )
and ( s [ i ] < > \ ')
then flag:=false;
if flag=false
t h e n L a b e l 3 . C a p t i o n : = ' B '
else

flag,
.
true. s ,
. length
.
. , , , length(s), .
,
flag false. flag.
false, , Label3, . flag true, . . ,
, else. else , .
.
, , , ( )
. -

410

16

.
preobri,
Buttoniciick,
preobr2.
Buttoniciick, .
. 16.3 .
:

| "

; ! "

'

. . . . ,

! 16.3. " "


unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Editl: TEdit;
Buttonl: TButton;
Label4: TLabel;
Button2: TButton;
Panell: TPanel;
Imagel: TImage;
procedure FormCreate(Sender: TObject);
procedure Buttoniciick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
( Public declarations }
end;
var
Forml: TForml;
x, y, k, t: integer;
c,z:real;

Delphi

411

flag:boolean;
a,b,s:string;
implementation
{$R *.dfm}
procedure TForml.FormCreate(Sender:

TObject);

begin
randomize;
k:=l; t:=0;
x: random (9)+1 ;
y:=random(9)+l;
a:=InttoStr(x);
b:=InttoStr(y);
Labell.Caption:='4eMy ?';
Label2.Caption:=a+'+'+b;
end;
procedure TForml.ButtonlClick(Sender: TObject);
var i:integer;
procedure preobrl;
begin
c:=StrtoFloat(Editl.Text);
if c=z then t:=t+l;
x:=random(9)+1;
y:=random(9)+l;
a:=InttoStr(x);
b:=InttoStr(y) ;
end;
procedure preobr2;
begin
Label3.Caption:=' ';
k:=k+l;
Editl.Text:='';
Editl.SetFocus
end;
begin
randomize;
flag:=true;
s:=Editl.Text;
for i:=l to length(s) do
if (s[i]<>'0') and (s[i]o'l') and (s[i]<>'2')

412
and (s[i]o'3')and (s[i]<>'3') and (s[i]<>'4')
and (s[i]<>'5') and (s[i]<>'6') and (s[i]<>'7')
and (s[i]<>'8') and (s[i]<>'9') and (s[i]<>'-')
and (s[i]<>',')
then flag:=false;
if flag=false
then Label3.Caption:=' '
else
case k of
1. .2: begin
z:=x+y;
preobrl;
Label1.Caption:=' ?';
Label2.Caption:=a+'+'+b;
preobr2
end;
3..5: begin
if k=3 then z:=x+y
else z:=x-y;
preobrl;
Labell.Caption:='4eMy ?';
Label2.Caption:=a+'-'+b;
preobr2
end;
6..8: begin
if k=6 then z:=x-y
else z:=x*y;
preobrl;
Labell.Caption:=' ?';
Label2.Caption:=a+'*'+b;
preobr2
end;
9..11: begin
if k=9 then z:=x*y
else z:=(x+y)/2;
preobrl;
Labell.Caption:=' ?';
Label2.Caption:=a+' '+b;
preobr2;
end;
12:
begin
if c=z then t:=t+l;
Editl.Visible:=False;

16

Delphi

413

Labell.Caption:='';
Label2.Caption:='';
Label3.Caption: = " ;
Buttonl.Visible:=False;
Label4.Visible:=True;
case t of
0..7:

Label4.Caption:=' 2V

8,9:

Label4.Caption:=' 3',

10,11: Label4.Caption:=' 4',


12:

Label4.Caption:='Bama 5',

end;
end;
end;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;
end.

1. f

?
7*6
:

'

.
.

'

'

. . . .

'..;:

. 16.7. " "



Button2Click,

16

414

(Button2).
. . 16.7 , ,
. 16.8 , .
/

?
9*3

. 16.8. " "


Delphi , ,
. 8.3. , 8.
.
( ), . :
,
, .
.
rabbit.wmf, Microsoft Office 97
Clipart\Popular.

1 7


Delphi
Delphi . . .

17.1. " "


, fix)
:
() = /()

= , = -0,
-*0 ^

Ay =

f(xo+Ax)-f(xo).

: Ay/
. ,

8. .
Delphi,
" " = -*2 - 4-.
.
,
. .
.

416

17

, , . caption, . (cisiiver). ,
, .
, , :
3- 4- 2 .
Microsoft Word, Delphi, ,
. .
" y=3-jc2-4-x" MS Word. Word 2 ,
| . , , ,
2. |
. , Word, :

=3-2-4-
- , .
Word <Alt>+<PrintScrn>.
Paint,
Windows,
, . . . |
Paint . - () Paint ,
.
| . | Paint
| Paint
.
Paint |
funct . imagei.
Picture
funct, imagei.
, ,
.

Delphi

417

Editi ,
Edit2 Edit3 . , ,
. ,
Labell, Label2, Label3 Label4 ( Label2 Label3
Edit2). Edit2 Buttoni ().
.
. Button2 ()
, Button3 ()
,
.
, .
Paneii, imagei. , , StudyWorks.
, Clipart, Microsoft Office, . , "
" (. . 16.3). (. 17.1).
.

Buttoni. Buttoniciick.
, :
, ;
dx ;
dyi dy2 ;
;
ekon , .
, dy.
iks , diks
. 14 3. 1068

17

418

.

iks+diks iks. dy
:
function dy(iks,diks:real):real;
begin
dy:=((3*(iks+diks)*(iks+diks)-4*(iks+diks))-(3*iks*iks-4*iks))/diks
end;

I fc


=3-2-4-

. 17.1. " "

ekon
,
Editl Edit2, . dx, 0,0001.
dy,
dyl, .
.
. 10.
dy dy2. dyl

Delphi

419

dy2. (
) .
, . dy2 .

Edit3. , ,
Floattostr. : . 34
. "" .
Object
Pascal.
, , .
, .
.

(Button3) (Button2). Button3Click , Button2ciick
, .
, . 17.1 .
| 17.1. " "
'|

.......;

...'.

;...

V...

unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Imagel: TImage;
Label1: TLabel;
Editl: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;

.......k.i

420

17
Buttonl: TButton;
Label4: TLabel;
Edit3: TEdit;
Button2: TButton;
Panel1: TPanel;
Image2: TImage;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);

private
( Private declarations }
public
{ Public declarations )
end;
var
Forral: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
const
k=10;
var
dx,dyl,dy2,e,ekon,x:real;
function dy(iks,diks:real):real;
begin
dy:=((3*(iks+diks)*(iks+diks)-4*(iks+diks))-(3*iks*iks-4*iks))/diks
end;
begin
x:=StrtoFloat(Edit1.Text);
ekon:=StrtoFloat(Edit2.Text);
dx:=0.0001;
dyl:=dy(x,dx);
repeat
dx:=dx/k;
dy2:=dy(x,dx);
e:=dy2-dyl;
dyl:=dy2

421

Delphi
until e<ekon;
Edit3.Text:=copy(FloattoStr(dy2) ,1, 6)
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Editl.Text: = " ;
Edit2.Text:='' ;
Edit3.Text:=''
end;
procedure TForml.Button3Click(Sender: TObject);
begin
close
end;
end.

. 17.2 , " " = 2.



,.


= 2 -4-



|o.ooi

iQEJoiOl


18.0000

. 17.2. " "

17.2. ""
,

422

17

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

J f(x)dx
a

:
. h = {b- a)ln. : XQ = a, X\=a + h, ...,
Xi = XQ + ih, ..., = b. J{x) ,
yt.
:

"", Object Pascal,


.
= sin(x). :
, ;
i ;
;
b ;
h ;
D ( );
( );
;
s .
,
. :

Delphi

423

var i,n:integer;
a,b,s,h,x,yp,yn,ykrreal;

Object Pascal
,
:
h:=(b-a)/n;
:=0;
:=;
for i : = l to n-1 do
begin
x:=x+h;
yp:=yp+sin(x)
end;
yn:=sin(a);
yk:=sin(b);
s:=((yk+yn)/2+yp)*h;

. :
, .
, .

;
,
, , ;
,
;
,
;
. ;
. , ;
;
, .

424

17

.
,
y=sin(x).
-.
, ( NI)
( N2).
( N3) ( N4). , .

. .
, . Editi 1, Edit2
2, Edit3 , ,
.

.
( Buttoni) ( Button2). sin(;c),
, . Edit4 Labeil.

. ( Paneil), ,
( imagel).
.
, , StudyWorks.
, , .
(. 17.3).
. , N3 N4,
. Buttoniciick, , , , ,
, ,

425

Delphi

. Button2ciick,
,
. 17.2 .
I If )>~sin(x)

jfr-

. 17.3. ""

! 17.2.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ExtCtrls,Unit2;
type
TForml = class(TForm)
MainMenul: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;

426
Memol: TMemo;
Editl: TEdit;
Memo2: TMemo;
Edit2: TEdit;
: TMemo;
Edit3: TEdit;
Buttonl: TButton;
Button2: TButton;
Label1: TLabel;
Edit4: TEdit;
Panel1: TPanel;
Image1: TImage;
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.N3Click(Sender: TObject);
begin
close
end;
procedure TForml.N4Click(Sender: TObject);
begin
Form2.Show
end;
procedure TForml.ButtonlClick(Sender: TObject);
var a,b,s,h,x,yp,yn,yk:real; i,n:integer;
begin
a:=StrtoFloat(Editl.Text);
b:=StrtoFloat(Edit2.Text) ;
n:=StrtoInt(Edit3.Text);
h:=(b-a)/n;

17

Delphi

427

:=;
:=;
for i:=l to n-1 do
begin
x:=x+h;
yp:=yp+sin(x)
end;
yn:=sin(a);
yk:=sin(b);
s:=((yk+yn)/2+yp)*h;
Edit4.Text:=copy(FloattoStr(s) , 1, 6)
end;
procedure TForml.Button2Click(Sender: TObject);
begin
Editl.Text:- 1 ';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:=''
end;
end.

( )

v = A,)

**>

10000
{ !


1.9899

. 17.4. ""

428

17

, , . .

. 17.4. ,
( ) , .

1 8

Delphi
Delphi ,
, , , , ,
Delphi. ,
, , , . , Delphi. 2005
67 . ,
Delphi , (53 ),
Visual Basic (31 ) (. 18.1).
, .
, , Delphi,
.
, . ,
,
Delphi.
Borland
.
http://www.borland.com , (. 18.2).
.

430

18
-: > > - Microsoft Internet E

fivu.

';.;' .i

-. .

*.

" '

J"J ^ : **

: ROOTS MANUVA "AWFULLY DEEP" (...)


npctyruiettifl1

!", * QfeiESd* ^!

:]

*"

| *~

-TQPAPfri:

-^0
I
< ?.|^

i ^

-'--

Mnwiw.Aitdi-cfub.ru

: :
SQkt)
Visual Basic (
1)
?| (28>
; ? (22)
? ^ " ? ^ f21)

Looad)
Pa&aJ(l8)

Bsd()

#f53)
: Delphi (67)
I Forth W
Fortran (

Prdoafl)
Python (1)
Slilkd)

0)

: ^, , ^^

(218)

23,27

> Perl.com - Perl


' , CPAftlj . Unb
Linux. Win32. Machtos. Qecvocoe; . . !*,

**1

. 18.1. ,

1..,..-1-.,,.^1,.7.,-7..-.--^

) http://www.borland.com/

j"j

Borland'

^ |: :**

| Intttrillion JI Sit*

| Solulloni | 01jjs I tonka j Suenort

DELIVER

i N>s 1 Enntl I Companr j DtveUptn

^ Purchase .

ft T1

quality software ON TIME


and ON BUDGET with

BORLAND CORE SDP


LARN MORt

(*)RrP!ll<tna
Menu 'eady tor use

. 18.2. Borland

Delphi

431

Downloads, Delphi.
, Delphi (. 18.3).
, .

^
."1

. . .

'

Borland
; Products i Downlead*

Service* I 5uaport

Partncn | News ft Enntl . Company ! Developers

4 Back to product documentation selector

DelpN

^ ^

-DELPHI DOCUMENTATION

Additional Resources
v Partners
Commuriitv

Choose your Delphi version and edition:


Delphi
Enterprise edfcn
J J) Profe*ionjl gjitiun
p Perform edition

Delphi S
ADO Express fProfessional upgraded
Professional edition

_
S] 1'

'

- : . - ..'.'.

zi

I " )

. 18.3. Borland,
Delphi

Borland .
.
http://www.borland.ru , Borland
(. 18.4).
"Development "
http://delphid.dax.ru. Delphi, Delphi,
(. 18.5).

Delphi (. 18.6).
Delphi, .
" Delphi " http://
www.delphi.dax.ru. Delphi, -

18

432
a lioil.mJ Rutsia

Miciojoll Internet Exploiei


'.

CSJBMC

.-..

; .

Borland

*\

UtpV/Ww. boiland.ru/

^ \'

| mitionjl Siti

TJ

, .

. 3 I \ * |

i 6*

DELIVER
quality software ON TIME
and ON BUDGET with

BORLAND CORE SDP

IT

Unenni

. 18.4. Borland

gna

> ,

Development

si

[ 200 j j ; f? COi-BtN i " Jitacceas


[ j~j , ^

y-;;f- u

17 FTP

\ riS!

i ^ ;
| mySQL

'

. : 1 | |

_ Pascal
[ I [ ]
Subscribe.Ru

, . .. )
e^rnai!

j OK |

Development - Delphi
^ ,
Delphi Pascal.
.
, !

* :

?* ;
"*

^ ! (
). ( Flash HTML)
. !! 1--

^ e-mail "Dey.elppment
?? - !
.

1 000
"Development "
BJ - http://delphjd.daii.iu/

. 18.5. "Development "

Delphi

433

'3 Development > Delphi - Microsoft Internet Exploier


.

Cjpeifc

EJ

. .

|:

Development

i*',',

.ru
20*
.cam...
.net , .10 i

. ; 5 | |
Paicai
:
[ ] [ ]
* Stibucriba.Ru


e-maii

[ JWj

Delphi
Delphi.

Delphi. , ,
(
).
.
, , !
, ,
^ ,

I n o r m

\ ^

Delphi -
FindFirst - 3000 "
1.

. 18.6. "Development ",


Delphi

, FAQ ( )
(. 18.7).
,
Delphi, (. 18.8).
" Delphi "
http://www.delphikingdom.ru.
Delphi, ,
,
(. 18.9).
"Delphi - Delphi for Russian"
http://atrussk.ru/delphi. on-line ( )
Delphi (. 18.10).
" DELPHI" http://delphi.mastak.ru.
,
, ,
(. 18.11). .
15 3. 1068

18

434
' 3 Delphi I - Miciosoft Interne!
fina
' ' ';

;8ftS,'#fi*'\

- procedure

THyClass.ClliidisariEylti.'.lSui.

;6^'-%mdow risk ' KNone>

RText:


T S S k

30.06,03 [ 1'. ]

" Delphi (* ,
" I

r p ^ g f t f i

&1!
-
I


18.06.03 [ c$v& |

e-mail
.

'iW)iS,

15.07.03 1 fiHlhH )

:ftU

jrj

! \ifr.32l Svttaml OataAcce! DataControls

Kg. TKeytooardStttse;

-.*^

| ! ,
i Delphi , ,
, , .. -
, , !
| (, , Delphi, Pascal, .)
50 ,

iu

. 18.7. " Delphi "


i Dekihi -

'

i^hdow Help. 'l-sT.


;<None>

p r o c e d u r e THyClass1

SvitKft \, Oala Access j D


]
: TKeyboardState*
BTexc: .trit.g; - ; ; l $ | !51>5 f^T | 'JlJ ( -

!!!,

>
-

* *! 1 MI 1
. <$ "Delprti6 - " .
&9 Rpe&tta3tWSJitU dtlf> '?';.. '.,'? /'-'-

- [1 j np9ffodw9fn&& * &, .. *
> << j & 4$ 32-&* *&;
., f A Q
f O Q VVtfjdCTwo &/200 (s VHncfows 32J.

- **

: 2552
3307

^ Win32 API
i /

' HSB.Mii;^i.Wi : ryw

Wfokv
: 266
1028

e-mail

Delphi ( 1.4.6 1.4.2001)


qpa c6qww*S9 on: /* &
$ / / <~>>-'
: 1410
1125

0 }

. 18.8. " Delphi ",


Delphi

Delphi

435

j j 1 I'll l i t I) I: T II I
j 5 '.

gt

, '.' > r'-'

- i,null Iriteinnt E|iloiei

: *

* | . ^ |i *

"Knowfedge ilaQlf is power"


F. Bacon

n^orpo
| | | <

BCQ

. 20 , :

Qleq Lozlnsklj | Vladimir Ermolaav | ^^ | | |


I I
. )

. 18.9. " Delphi "

^^ *
~*

'iii'
:..,,... . .

ylJ
.
.0<.

i-Jj. 1
.' ' " W '

i *

**'

-C_J

.'

'
> '. .

FAQ
WindowsAPI
DELPHI

Borland,
Delphi, .
Delphi
1- , -
,
.
, ,

Delphi.
,
-. help-,
?
. ,
[F1] ( - ).

Delphi
DO ( 25%

, ,
Delphi, " ".
! :)
...

On-line

WindowsAPI
DELPHI

ClipArt


ig) ..

. 18.10. "Delphi - Delphi for Russian"

436

18

| | | FAQ | | | VCL j | |
I I I I I Corba I DelphiGFX I KOL I

DELPHI


Windows.

, Delphi. ,
" Delphi",
, !
, ,

email
, ,

(, - ...
, , -, ),
Delphi .
.
, PBPrcviewDlalog u.4.30.00.00
- . (2)
BOpenPrftviewDiabQ
Delphi !
SSavePra'/iswDialog -
Open/Save

, * .
. - . ..'
internet,


CDelohi
:1
'

. 18.11. " DELPHI"

DelphiN http://delphinsworld.narod.ru.
, ,
Delphi, (. 18.12). ,
Delphi,
-.
"
Delphi-"
http://
www.delphiugolok.narod.ru.
Delphi (. 18.13).
, , : .
"Delphi32 " http://delphi32.narod.ru.
Delphi, (. 18.14).

Delphi.
"Borland X Portal" http://
borland.xportal.ru. -

Delphi

437

oft Internet Explorer

Qpawa

.-

.- -" v a

'.

id '.'a

www.DeIphiNsWorld.Narod.ru
| | | | FAQ | | | | |
| | | |

- Delphi, a
. !
, .

?!
, . ,
!
- ,
^] ..

" "

'

\.' " ';.' ,

'. "-:'..

,;

> '

. 18.12. "DelphiN"
Delphi- - Mic

-"

CJPBMC

LJLJ

_JJ
/

irt

LJ

<5

'.,1*

Delphi-
,
Delphi
NISSAN ALMERA

Censer
788-58-58

; |
s I I I pAQN?! I FAQ 31

I !

| |

: ...( - !) - !


,,.

Dcwnloads

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

. 18.13. " Delphi-"

438

18
HEJOl

<012-1| |) - Miciuui Internet t ptaier


' ^

'

,:

'

;.

'

r _ ^ J .

_ j j

...

"

Delphi 32
'

] ];

belohiVOLFAQ

;RUS |j36,6 j


WIN API,

>

" ]|25-76 ' "j @ '"'

;ENG IjSOS ! !

1?_>1_ . ^ ,

I1

DirectDraw

| 1

Faq no (RTF)

***

RUS ;6,54 |

1|

jiRUS !49

i 't.l.H Fv^V'.n.O H ! ' . O . K I ; J !


' ' ^ ( ' . ^ ' ' >;' tlE-iV ^T*l -U Ur."i fr Hl-" ' -

15523

RUS ; 16,9 j

; 1

'

j RJS !7,40 !

|'

IjRus ;1,2!*

|!

ffliHasgnBirii

.;:;;, ; ; ; ; : : ; : ; , , : , ; , , . t;:,T^.'

|l}CicM<npeUiiVaFAa

: t f

. 18.14. "Delphi32 ",


, Delphi

' '' '

I '

, '

20, 200

Borland X

Delphi




<?

: j

11

"

. '

I TBHY 1

i

"
. Delphi
. WindowSj DOS,

I

, ,

. 18.15. "Borland X Portal", Delphi

Delphi

439

Borland, , , Delphi (. 18.15). .


, Delphi, . ,
, .

1 9



, 3 10 13 16.

3
; 1
program z3_l;
Uses Crt;
begin
ClrScr;
Textcolor(Magenta);
TextBackground(LightGray);
writeln(' ');
writeln(' :');
writeln() ');
writeln('2) ');
writeln('3) ');
readln
end.

I 2
i...

program z3_2;
Uses Crt;
begin
ClrScr;

>

.;......

442

19

Textcolor(green);
writeln('
*');
writelnC
***');
writeln('
*****');
writeln ('
****,***!).
writelnC
*********<).
writelnC
***********.);
writelnC * * * * * * * * * * * * * ' ) ;
writeln(***************');
readln
end.

j 3
program z3_3;
Uses Crt;
var
cl,ml,c2,m2,c3,m3,r,tl,t2:integer;
begin
ClrScr;
writeln(' ');
writeln(' , Enter');
readln(cl);
writeln(' , Enter');
readln(ml);
writeln(' ');
writeln(' , Enter');
readln(c2);
writeln(' , Enter');
readln(m2);
tl:=cl*60+ml; t2:=c2*60+m2;
r:-t2-tl;
c3:=r div 60; m3:=r mod 60;
writeln(' ');
writeln(' ',,' ',,' ');
readln
end.

| 4
program z3_4;
Uses Crt;
const
p=3.1416;


var
r,l,s:real;
begin
ClrScr;
writeln(' ') ;
readln(r);
l:=2*p*r;
s:=p*r*r;
writeln(' ',1:7:2);
writeln(' ',s:7:2);
readln
end.

I 5
program z3_5;
Uses Crt;
var
kgl,kg2,kg3:integer;
rl, r2, r3, cl,c2,c3,stl,st2,st3,stoim:real;
begin
ClrScr;
writeln(' ( )');
readln(kgl);
writeln(' 1 ,');
writeln(' Enter,');
writeln(' Enter');
readln(rl); readln(cl);
writeln(' ( )');
readln(kg2);
1
writeln(' 1 , );
writeln(' Enter,');
writeln(' Enter');
readln(r2); readln(c2);
writeln(' ( )');
readln(kg3);
writeln(' 1 ,');
writeln(' Enter,');
writeln(' Enter');
readln(r3); readln(c3);
stl:=(rl+cl/100)*kgl;
st2:=(r2+c2/100)*kg2;
st3:=(r3+c3/100)*kg3;
stoim:=stl+st2+st3;

443

444

19

writeln(' ',stoim:6:2,' ');


readln
end.

| 1
program z4_l;
Uses Crt;
var
n:integer;
begin
ClrScr;
writeln(' ');
readln(n);
if n mod 5 =0 then writeln(' 5')
else writeln(' 5');
readln
end.

2
program z4_2;
Uses Crt;
var
n:integer;
begin
ClrScr;
writeln(' ');
readln(n);
if (n>0) and (n mod 2 =0)
then writeln(' '
else writeln('
^ ');
readln
end.

| 3
program z4_3;
Uses Crt;

var
so,sk,n,:integer;
begin
ClrScr;
writeln(' ');
readln(so);
writeln(' ');
readln (sk);
if sk>so

then n:=sk-so
else n:=so-sk;

c:=n*3;
writeln(' ',,' ');
readln
end.

[ 4
program z4_4;
Uses Crt;
var
so, sk, n, c, k: integer;
begin
ClrScr;
writeln(' ');
writeln(' :');
writeln('l - ');
writeln('2 - ');
writeln('3 - ');
readln();
writeln(' ');
readln(so);
writeln(' ');
readln (sk);
if sk>so

then n:=sk-so
else n:=so-sk;

case k of
1: c:=n*3;
2: c:=(n*3)*2;
3: c:=(n*3)*15;
end;
writeln(' ',,' ');
readln
end.

445

446

19

5
"'"'"'"

',"

"""

" ' " " "

'

'.

'

'

'

'.'"

::--"

'

'

| 1
program z5_l;
Uses Crt;
const
n=25;
var
i,k,r:integer;
begin
ClrScr;
k:=0; ( - ,
}
writeln('
> ') ;
for i:=l to n do
begin
writeln(' ',i,' ');
readln(r) ;
if r>=175 then k:=k+l
end;
writeln(' ');
writeln(' ',);
readln
end.

I 2
:.,

.,

,......

program z5_2;
Uses Crt;
const
n=5;
var
i:integer; d,s,p:real;
begin
ClrScr;
writeln(' ');
readln(s);
writeln(' ');
readln();

'

447

for

i:=l to n do
begin
d:=s*p/100;{ }
s:=s+d { }
end;
writeln(' ');
writeln(' ',8:8:2,' ');
readln
end.
m"""'",

"""

";

'

-:

>

...-".....:

I 3
program z5_3;
Uses Crt;
const
s=1000000;
var
i,k:longint;
begin
ClrScr;
i:=l; {i - }
k:=l; {k - }
repeat
k:=k*2;
i:=i+l
until k>s;
writeln(' ',i,' ');
writeln(' ');
readln
end.

I 4
program z5_4;
Uses Crt;
var
i,k,s:longint;
begin
ClrScr;
i:=1; {i - }
k:=l; {k - }
s:=l; { , i }

448

19

while s<=1000000000 do
begin

s:=s+k
end;
writeln(' , ');
writeln(' , ',i+l);
readln
end.

6
1
program z6_l;
Uses Crt;
var
i,l:integer; flag:boolean; c:char; s:string;
begin
ClrScr;
flag:=true;
writeln(' ');
readln(s);
l:=length(s);
for i:=l to 1 do
begin
c:=s[i] ;
1
if (co'O') and (co'l ) then flag:=false
end;
if flag=true
then writeln{' ')
else writeln(' '),
readln
end.

| 2
program z6_2;
Uses Crt;
var
i,k,ks,1:integer; :char; s:string;

449

begin
ClrScr;
writeln(' . Enter');
writeln;
readln(s) ;
l:=length(s);
k:=0;(k - }
for i:= 1 to 1 do
begin
c:=s[i];
if c=' ' then k:=k+l
end;
ks:=k+l;
writeln;
writeln(' ',ks);
readln
end.

| 3
program z6_3;
Uses Crt;
var
i,k,ks,l,n:integer; dl:real; :char; s:string;
begin
ClrScr;
writeln (' . Enter');
writeln;
readln(s);
1:-length(s)i
k:=0;(k - }
for i:= 1 to 1 do
begin
c:=s[i];
if c=' ' then k:=k+l
end;
ks:=k+l;
n:=l-k; {n - , }
dl:=n/ks;
writeln;
writeln(' ',dl:6:2, ' ');
readln
end.

450
f

19
'

-"-

...,,......,;

.........

,.,

,.,,..

| 4
program z6_4;
Uses Crt;
var
i,l,:integer; s:string; c,x:char;
begin
ClrScr;
writeln(' ');
readln(s);
l:=length(s);
writeln;
writeln(' :');
writeln;
for i:=l to 1 do
begin
c:=s[i];
o:=ord(c)-10;
x:=chr(o);
write(x)
end;
writeln;
readln
end.

7
| 1
program z7_l;
Uses Crt;
var
i,k,n:integer; m:array[1..20] of integer;
begin
ClrScr;
writeln(' ');
readln(n);
k:=0;
writeln;
for i:= 1 to n do
begin
writeln(' ',i,' ');

,........;

'".]

451

readln(m[i]);
if m[i]>0 then k:=k+l
end;
writeln;
writeln(' ',);
readln
end.

I 2
i.u:

:...:..;

:..

program z7_2;
Uses Crt;
var
a,b,i,k,n:integer; m:array[l..25] of integer;
begin
ClrScr;
Randomize;
k:=0;
writeln(' ');
readln(n);
writeln(' a');
readln(a);
writeln(' b ' ) ;
readln(b);
for i:=l to n do
begin
m[i]:=random(50)+l;
write(m[i],' ' ) ;
if (m[i]>=a) and (m[i]<=b) then k:=k+l
end;
writeln;
writeln(' , ');
writeln(' ',,' ',,' ',);
readln
end.

| 3
program z7_3;
Uses Crt;
var
i,k,n:integer; a:array[1..20] of integer;

452
begin
ClrScr;
k:=0;
writeln(' ');
readln(n);
writeln;
for i:=1 to n do
begin
writeln(' ',i,' ');
readln(a[i]);
if a[i]<0 then k:=i
end;
for i:=l to n do
write(a[i],' ' ) ;
writeln;
writeln(' ');
writeln(' ',);
readln
end.

j 4
program z7_4;
Uses Crt;
var
a,k:char; i,g:integer; mas:array[0..255] of integer;
begin
ClrScr;
writeln(' ');
writeln(' "0"');
writeln;
repeat
read(a);
i:=ord(a);
mas[i]:=mas[i]+1;
until a='0'; { }
readln;
g:=0;
writeln;
writeln(' ' ) ;
writeln(' :');
for i:=0 to 255 do
begin

19


if (mas[i]<>0) and (i<>48) then
{48 - ASCII}
begin
g:=g+l;
k:=chr(i);
if i<>32 (32 - ASCII}
then write <"",k,'" - \mas[i],' I ')
else write('"" - ',mas[i],' | ')
end;
if g mod 5 = 0 then
begin
g:=l;
writeln
end;
end;
readln
end.

1
program z8_l;
Uses Crt;
var
a,b,:integer; s,p:real;
begin
ClrScr;
writeln(' ');
readln();
writeln;
writeln(' ');
readln(b);
writeln;
writeln(' ');
readln();
writeln;
p:=(a+b+c)/2;
s:=sqrt (p*(p-a) *(p-b)*(p-c)) ;
writeln(' ',s:8:2);
readln
end.

453

454

19

! 2
/',;;

...;,,.,. ...... I..'.

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

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

.',..

'

;.

program z8_2;
Uses Crt;
var
n,x,rl,r2:integer; r3:real;
begin
ClrScr;
writeln(' ');
readln(n);
writeln;
writeln(' , ');
writeln(' ');
writeln;
writeln (' :');
writeln;
writeln('1 - ');
writeln('2 - ');
writeln('3 - ');
readln(x);
writeln;
case x of
1: begin
rl:=abs(n);
writeln(' ',rl)
end;
2: begin
r2:=sqr(n);
writeln(' ',2)
end;
3: begin
if n>=0 then
begin
r3:=sqrt(n);
writeln(' ',:8:3)
end
else
begin
writeln(' ');
writeln(' ');
end;
end;
end;

'.

455

readln
end.

I 3
program z8_3;
Uses Crt;
label 10;
var
flag,n,x,rl,r2:integer; r3:real; t:string;
function (s:string):boolean;
{ ,
.
,
, ,
0 9}
var
i,k:integer;
begin
c:=true;
k:=length(s);
for i:=l to k do
if (s[i]<>'0') and (s[i]o'l') and (s[i]<>'2') and (s[i]<>'3')
and (s[i]<>'4') and (s[i]<>'5'] and (s[i]<>'6') and (s[i]<>'7')
and (s[i]<>'8') and (s[i]<>'9')
then c:=false
end;
begin
ClrScr;
10: writeln(' ');
readln(t); { }
writeln;
if c(t)=true then val(t,n,flag)
{ ,
,
}
else
begin
writeln(' ');
goto 10
end;
writeln(' , ');
writeln(' ');
writeln;

456

19

writeln(' :');
writeln;
writeln(' 1 - ');
writeln(' 2 - ');
writeln('3 - ');
readln(x) ;
writeln;
case x of
1: begin
rl:=abs(n);
writeln(' ',rl)
end;
2: begin
r2:=sqr(n);
writeln(' ',r2)
end;
3: begin
if n>=0 then
begin
r3:=sqrt(n);
writeln(' ',:8:3)
end
else
begin
writeln(' ');
writeln(' ');
end;
end;
end;
readln
end.

( 4

program z8_4;
Uses Crt;
var
i,k,x:integer; mas:array[1..20] of integer; flag:boolean;
procedure prost(x:integer; var f:boolean);
var
j:integer;
begin
f:=true;


if

(x=l)

or

(x=2)

then exit;

{ 1 2 }
for j:=2 to x-1 do
{ }
if rood j =0 then
{ }
begin f:=false; exit end { }
end;
begin
ClrScr;
Randomize;
k:=0; {k - }
writeln(' :');
for i:=l to 20 do
begin
masfi]:=random(99)+l;
write(mas[i],' ' ) ;
x:=mas[i];
prost(x,flag); { ,}
{ }
if flag=true then k:=k+l
end;
writeln;
writeln;
writeln(' , ');
writeln(' ',);
readln
end.

i 5
program z8_5;
Uses Crt;
var
i:integer; flag:boolean;
procedure sov(k:integer; var f:boolean);
var
s, j .-integer;
begin
f:=false;
s:=0;{s - }
for j:=l to k-1 do
if mod j =0 then s:=s+j;
{
}

457

455

19

if k=s then f:=true


end;
begin
ClrScr;
writeln(' 1 10000');
writeln;
for i:=l to 10000 do
begin
sov(i, flag);
if flag=true then writeln(i)
end;
readln
end.

9
;

"

v-r---;

1
program z9_l;
Uses Crt;
var
k,l:integer; t:text; ln:string[80];
begin
Clrscr;
k:=0;
assign(t,'A:\tekst.txt');
rewrite(t);
writeln(' .
Enter');
writeln;
writeln(' ');
writeln(' * ' ) ;
writeln;
repeat
readln(In);
writeln (t, In) ;
k:=k+l;
l:=length(ln)
until ln[l]='*';
writeln;
writeln(' ');
writeln(' ',);

459

close(t);
readln
end.
p.,,,........,..,.....

...;...., ... ,.,...,.,...

,..

.;

| 2

program z9_2;
Uses Crt;
var
k,l:integer; t:text; In,kol:string[80];
begin
Clrscr;
k:=0;
assign(t,'A:\tekst.txt');
rewrite(t) ;
writeln(' .
Enter')i
writeln;
writeln(' ');
writeln(' * ' ) ;
writeln;
repeat
readln(In);
writeln(t,In);
k:=k+l;
l:=length(ln)
until ln[l]='*';
str(k+l,kol);
kol:=' '+kol;
writeln(t,kol);
writeln;
writeln(' ');
writeln(' ',+1);
close(t);
readln
end.
..(iii

.I,,,,...............,,...

1.,.,.....>.....

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

,.,,.

j 3
program z9_3;
Uses Crt;
var
i,n,s,x:integer; f:file of integer;

460
begin
ClrScr;
assign(f,'A:\number');
rewrite(f);
s:=0;
writeln(' , ');
readln(n);
writeln;
for i:=l to n do
begin
writeln(' ',i/' ');
readln(x);
s:=s+x;
write(f,x)
end;
write (f,s) ;
writeln;
writeln(' ');
writeln;
writeln(' ');
reset(f);
for i:=0 to n do
begin
read(f,x) ;
write(x,' ')
end;
close(f);
readln
end.

4
program z9_4;
Uses Crt;
var
i,n,x:integer; g:string; u:file;
begin
ClrScr;
assign(u,'A:\contents') ;
rewrite(u);
writeln(' ');
readln(n);
writeln;

19


for

461

i:=l to n do
begin
writeln(' ');
readln(x);
blockwrite(u,x,1);
writeln(' ');
readln(g);
blockwrite(u,g,1);
end;

close(u);
writeln(' ');
writeln;
reset(u);
writeln(' "contents" ');
for i:=l to n do
begin
blockread(u,x,1);
write (' ',, ' ' ) ;
blockread(u,g,1);
write(g);
writeln
end;
close(u);
readln
end.

10
i !

"

program zlO_l;
Uses Crt;
type month=(error,jan,feb,mar,apr,may,jun,jul,aug, sep, oct,nov, dec);
var i:integer; name:string; mes:month;
begin
ClrScr;
writeln(' ');
readln(name);
if name='' then mes:=jan;
if name='' then mes:=feb;
if ='' then mes:=mar;
if name='' then mes:=apr;

462
if ='' then mes:=may;
i f name='' then mes:=j un;
if name='' then mes:=jul;
if name='' then mes:=aug;
if name='' then mes:=sep;
if name='' then mes:=oct;
if name=' ' then mes:=nov;
if name='' then mes:=dec;
case mes of
jan,feb,dec: writeln('Ha ');
mar,apr,may: writeln(' ');
jun,jul,aug: writeln(' ');
sep,oct,nov: writeln('3a ');
else writeln(' ');
end;
readln
end.

program zlO_2;
Uses Crt;
label 10;
type
god=1600..2100;
var
n:god;
begin
ClrScr;
writeln;
10: writeln(' ( 1600 2100)');
readln(n);
if (n<1600) or (n>2100) then goto 10;
writeln;
if n mod 100=0
then
if n mod 400=0 then writeln(' ')
else writeln(' 1;
else
if n mod 4 =0 then writeln(' ')
else writeln(' '),
readln
end.

19

463

i
program zlO_3;
Uses Crt;
label 10;
type uchenik=record
fam, name:string;
mat,f iz,lit,ist,inos:integer
end;
var
i,k:integer; s,otvet:string;
zap:uchenik; ved:file of uchenik;
begin
ClrScr;
assign(ved,'A:\vedomost');
rewrite(ved);
k:=0;
repeat
writeln(' ');
readln(zap.fam);
writeln(' ');
readln(zap.name);
writeln(' ');
readln(zap.mat);
writeln(' ');
readln(zap.fiz);
writeln(' ');
readln(zap.lit);
writeln(' ');
readln(zap.ist);
write(ved,zap);
k:=k+l;
ClrScr;
writeln(' ');
10: writeln(' "" ""');
readln(otvet);
if (otveto'fla1) and (otveto'HeT') then goto 10
until otvet='';
ClrScr;
writeln(' ',k);
writeln;
writeln(' ');
writeln;

464

19

write('
|
| |
|
I');
writeln(' I ') ;
write('
|
I
|
I
);
writeln('
I');
reset(ved);
for i:=0 to k-1 do
begin
read(ved,zap);
write(zap.fam:11,'|',zap.name:11,'I',zap.mat:11,'|',zap.fiz:11,'I');
writeln(zap.lit:11,'|',zap.ist:11,'I');
end;
close(ved);
readln
end.

| 4
program zlO_4;
Uses Crt;
var
k:integer; c:char;
eng: set of 'A'..'Z'; rus: set of ''..''; cifra: set of '0'..'9';
leng: set of 'a'..'z';
lrusl: set of 'a'.-'n'; Irus2: set of ''.-'';
{
, . . ASCII
, , ,
}
begin
ClrScr;
cifra: = ['0\. 9' ] ;
rus:=['A'..''];
leng:=['a'..'z'];
lrusl:=['a'..'n'];
Irus2:=['p'..''];
writeln(' ');
readln();
writeln;
if in cifra then k:=l;
if in eng then k:=2;
if in rus then k:=3;

465


if in leng then : =4;
if

( in lrusl)

or ( in Irus2) then k:=5;

case of
1: writeln(' ');
2: writeln(' -
> ') ;
3: writeln('
^ ') ;
4: writeln('
> ') ;
5: writeln('
> ') ;
else writeln(' ,
> ')
end;
readln
end.

13
. 19.1 "".
;


<

. 19.1. ""

16 3. 1068

466

19

\ ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls;
type
TForml = class(TForm)
RadioGroupl: TRadioGroup;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
RadioButtonl: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Buttonl: TButton;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
procedure RadioButtonlClick(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.RadioButtonlClick(Sender: TObject);
begin
Shapel.Brush.Color:=clRed;
Shape2.Brush.Color:=clSilver;
Shape3.Brush.Color:=clSilver;
end;

467

procedure TForml.RadioButton2Click(Sender: TObject)


begin
Shape2.Brush.Color:=clYellow;
Shapel.Brush.Color:=clSilver;
Shape3.Brush.Color:=clSilver;
end;
procedure TForml.RadioButton3Click(Sender: TObject)
begin
Shape3.Brush.Color:=clGreen;
Shapel.Brush.Color:=clSilver;
Shape2.Brush.Color:=clSilver;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
close
end;
end.

14
. 19.2 "".
I

, 5 0 .

:::::::

""::::::::;:;:


- ;
1000 ;.; I
5 0 0 ; ''{

100 ; ; I
50

. 19.2. ""

468

19

""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Labell: TLabel;
Editl: TEdit;
Label2: TLabel;
Label3: TLabel;
Panel1: TPanel;
Image1: TImage;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Buttonl: TButton;
Button2: TButton;
Label8: TLabel;
Label9: TLabel;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}

469

procedure TForml.ButtonlClick(Sender: TObject);


begin
close

end;
procedure TForml.Button2Click(Sender: TObject);
var sum, klOOO, k500, , k50,
ostlOOO,ost500,ostlOO:integer;
begin
sum:=StrtoInt(Editl.Text);
kl000:=sum div 1000;
ostl000:=sum mod 1000;
k500:=ostl000 div 500;
ost500:=ostl000 mod 500;
kl00:=ost500 div 100;
ostl00:=ost500 mod 100;
k50:=ostl00 div 50;
Edit2.Text:=InttoStr(kl000);
Edit3.Text:=InttoStr(k500);
Edit4.Text:=InttoStr(klOO);
Edit5.Text:=InttoStr(k50)
end;
end.

15
. 19.3
"".
! ""
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls;
type
TForml = class(TForm)
Label1: TLabel;
Editl: TEdit;

470

19
Buttonl: TButton;
Label2: TLabel;
Label3: TLabel;
Panel1: TPanel;
Image1: TImage;
Button2: TButton;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var :integer;
begin
Label2.Visible:=True;
Label2.Caption: = 'flaHHbiii ';
Label3.Vis ible:=True;
k:=StrtoInt(Editl.Text);
if mod 100 <>0
then
if mod 4 =0
then Label3.Caption:=' '
else Label3.Caption:='He '
else
if k mod 400 =0
then Label3.Caption:=' '
else Label3.Caption:=' '
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;

471

procedure TForml.Button3Click(Sender: TObject);


begin
1
Editl.Text:- ';
Label2.Visible:=False;
Label3.Visible:=False
end;
end.

: : : : : : : , : :;::

.;
i

id

2004

ZJ

:. .

5 e 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24. 25 2E 27 28

2 3 4

I
:

1:

. 19.3. ""

16
. 19.4
" ".
! " "
<

...ill. ,,,>..>.>....

,...>...

...........i

unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;

472

. 19

type
TForml = class(TForm)
Label1: TLabel;
Editl: TEdit;
Label2: TLabel;
Label3: TLabel;
Panel1: TPanel;
Image1: TImage;
Buttonl: TButton;
Button2: TButton;
Button3: TButton;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
( Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R
procedure TForml.ButtonlClick(Sender: TObject)
var k,n:integer;
function rab(m:integer):integer;
begin
if m=0
then rab:=l
else
if m=l
then rab:=2
else rab:=rab(m-2)+rab(m-1)
end;
begin
n:=StrtoInt(Editl.Text) ;
k:=rab(n)*2;
Label2.Visible:=True;
Label2.Width:=200;


Label2.Caption:='no
> ' + I n t t o S t r ( ) ;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
close
end;
procedure TForml.Button3Click(Sender: TObject);
begin
Editl.Text:-1';
Label2.Visible:=False;
Label2.Caption:='';
end.

. 19.4. " "

473


Turbo Pascal
Turbo Pascal , , .
, ,
, , , ^ .

1.1.

,
Turbo Pascal.
(, Norton Commander) ,
, , .
Norton Commander, : pas <Enter> Turbo Pascal.
Norton Commander (
), <F9>.
<Enter>. , <Enter>.

476

<Enter> ,
(. 1.1). , ( , , ).

<F6>.
, .
:1
4372ansi
8502ansi
8632ansi
8652ansi
8662ansi
ansi2437
ansi2850
ansi2863i (
ansi2865i (
ansi2866 i
arcoiew
(
bitnap
bug
bungee I
clp2dib j
dbvieu

mm

:-.
.exit doc
clean exe
clean ini
exe
nsg
edit
exe
edit
nsg
ff
hip
ff
nsg
label exe
in
exe
net
exe
net
nsg
pscrip hdr
sf
exe
sf
nsg

) :

.1,|;|)1> !.! ]

) (!)
)
(!:)
)
CSV)
)

exit

exe

nc exit

51
conlncsi

. 1.1.

()
pas ( ).
, .
, , , (), , .
"\" (backslash ).
, D:
7, : d: \TP7\turbo.

.
<Esc>.
, ,
. -

Turbo Pascal

477

pas Turbo Pascal. , , . .

1.2.

. Edit.
,
, .
. 1.2.
, .
, .
, ,
<1>+< >, <1>+< >. , <>,
<End>.
<Page Up> ,
<Page Down> . . , ,
<Ctrl>+<Page Up>, , , <Ctrl>+<Page Down>.
.
, ,
. ,
. (
Turbo Pascal ),
.
, .
,
,
.

478
IHTuibo Pascal
earch

Hun

Compile

Debug

foolsUptions

Window

n2:=o
n3:=ost nil (I ii),
sun:=n1+n2+n3;

writelnC'Cytna ',*,' ',sun);


readln
end.

Help| Copy the selected text into the Clipboard

. !

. 1.2. Edit Turbo Pascal

, , . .
, . , , .
.
- , , <Shift>
< > < >. . , .
, , < >
< >,
. .
""
, , ,
.
, ,
Edit Clear ()
<Ctrl>-KDel>.

Turbo Pascal

479

,
<Ctrl>-KY>.

<Ctrl>+<N>.
, . , . : - ,
( ).
, , .
Cut, Edit ( ,
<Shift>-KDel>).
, .
( <Ctrl>+<Ins>). , , ,
,
, ,
. Paste (
<Shift>+<Ins>) ,
.
Turbo Pascal ,
- ,
, ,
. , , , - , Show
clipboard ( ).
.
Clear.
"", 3. ,
"" , writeln, , .
, , .
. , . , Edit. ,
.
<Enter> . -

480

Edit Paste, , .

Paste. , ,
.
, Undo.
, Redo.
, .
: . , - , , ,
.
<Ins>, , . , , .

, . , . .
. , <Ins>.

1.3.
, , ,
, , ,
.
, , , , .
, (
). , , - : .

Turbo Pascal

481

, ,
. -,
, Help.
, Contents Index. Contents
, ,
How to Use Help ( ), Menus and Hot Keys (
), Editor Commands ( ), Functions and Procedures ( ), Error messages ( ), Reserved
Words ( ) . .
. 1.3.
Turbo Pascal

Search

Hun Compile

DebugToolsOptions

WindowHelp

(program peruprog;
begin
How to Use Hel
Menus and Hot leys
Editor Comnands
functions and Procedures
Built-in ftssembler
Cowiand 1 ine
"bugging
ii*eeti<es
Lfror Messages
ObjectBrewser

F1 Help on help ftlt+F1 Previous topic

Beserwed Words
Sample Programs
Start-Up Options
Turbo Vision
Units
Glossary
Windows DPI

Snitt+FI Help index

tsc Close help

. 1.3.

Index , .
, ,
. -,
, ,
. -, . , . , -

482


<Enter>,
Help . , , , , .
, read,
Help Index,
re,
Read <Enter>. ,
read ( ,
, r e a d ,
; , , 8 ), ""
(ReadKey, Readln, Write, Writeln) ,
(- Sample
code), read. read Eof.pas. , .

(
) . "" " , ".
|r

Tuibo Pascal

new name you want to sawe the f i l e under,


file-name ask for the Files l i s t box.

elp on help

Blt+F1 Precious topic

Shift+M Help index

. 1.4.

tsc Hose help

Turbo Pascal

483

<F1>,
( , , ),
. , , ,
, <F1>,
(. 1.4).

1.4.
, , . ,
.
, , , , .
. (
, ).
Turbo Pascal
.
, .
. , (
), (
). , ,
. , .
. , ,
.
, , Window.
:
( Cascade) ( Tile) (. 1.5). () , . . ,
,

484

, ,
.
Turbo Pascal
i l e Edit Search Run Compile Debug Tools Options Window Help
WJlill " * M J - H *~7\
anilitil IKE
program denocolor;
rogran bankomat;
Uses Crt;
war sun,k100,kSD,k10,vspon:integer;
begin
begin
ClrScr;
ritelnC' cyrny, 10');
TextBackground(LightGray);
readln(sun);
TextColor(Red);
1U0:=sum diu 100;
uriteln('3Ta nporparna
spon:=sun nod 100;
&0:=Mspon div 50;
TextColor(Green);
iwriteln(' vspon:=vspom nod 50;
\...\PR0G1.PHS

program surma;
Uses Crt;
,,:integer;
begin
ClrScr;
writeln (' 2 ');
uriteln ('
readln(a);
readln(b);
c:=a+b;

;rogran flight;
nses Crt;
ar i:integer;
* eg in
i.lrscr;
uriteln ('
writeln (' "Ent
ceadln(i);
f i=1961
then uriteln ('

Hake M t H I Local menu


Tuibo Pascal
I-lie Edit Search

Bun Compile

Debug

program denocolor;
Uses Crt;
begin
ClrScr;
TextBackground(LightGray);
TextColor(Red);
writeln(' nporpama
TextColor(Green);
writeln('

lools

Options

Window

Help

rogran bankonat;
ar sun,k100,k5D,k10,vspon:integer;
egin
ritelnC' cymy, 1 0 ' ) ;
eadln(sun);
I100:-sun div 100;
spon:=sun nod 100;
50:=vspon div 50;
spom:=vspon nod 5 0 ;

\.. IF\FL ICttT'.


4|
\...\PR0G1.PflS = = 3 = [ T ] = n
program surma;
!rogran flight;
Uses Crt;
Ises Crt;
var a,b,c:integer;
ar i:integer;
begin
egin
ClrScr;
lrscr;
writeln (' 2 ');
riteln ('

readln(a);
readln(b);
c:=a+b;
1:15

L
pile

eadln(i);
f i=1961
hen writeln ('
1) Make

A l t + Local menu

. 1.5. [) ()

,
Previous,
, Next (

Turbo Pascal

485

).
, Close. , List
(. 1.6). ,
, ,
. - ,
Delete,
.
Pascal

Hie

tdit Search

Bun Compile Debug

lools Opt inns Window Help

NONfiMfDI.PAS
\TP7\PR0G\MATH
\TP7\PR0C\C0UHT.PftS
TP7\PB06\MeTHEM.P(lS:?

lp | Use cursor keys to examine windows in window list


. 1.6. , ,
Turbo Pascal

,

, . ,

. , ,
.
,
, Tile (-.5, ). , . .
.

486

( ),
.
,
Zoom. , , Size/Move.
( ).
< >, < >, < >,
< >. ,
<8>+< >,
<8>+< >, <8>+< >, <8>+< >.

<Enter>. <Esc>.
,
Close all.


Delphi

Delphi .

File
New . ( : Application
, Form , Unit .).
Open project .
Open , (
).
Save ,
.
.
Save as .
.
Save Project as .
Save All , .
Exit .

Edit
Undo .
Redo .
Cut .

488

Copy .
Paste , .
Delete .
Select all (
).

Search
Find .
Replace
.

View
Forms , .
Units , .
Toolbars .

Run
Run .
Program Reset .


Delphi

Undeclared identifier .
,
.
, .

.
Not enough actual parameters .
- . .
Too many actual parameters . .
.
Unterminated string .
.
.
Unexpected end of file .
.
.
Incompatible types .

(, ).

, .

490

Missing operator or semicolon .


. .
',' or ':' expected but';' found ,
.
, .
.
')' expected but ';' found .
.
Statement expected but 'PROCEDURE' found

end. end.
Declaration expected but identifier found
begin . begin.


1. Borland Delphi 6 for Windows. Developers Guide. Borland Software Corporation. Scotts Valley, CA, 2001.
2. Borland Delphi 6 for Windows. Object Pascal Language Guide. Borland Software Corporation. Scotts Valley, CA, 2001.
3. Borland Delphi 6 for Windows. Quick Start. Borland Software Corporation.
Scotts Valley, A, 2001.
4. Kent Reisdorph. Teach Yourself Borland Delphi 4 in 21 Days. Macmillan Publishing, Indianapolis, IN, 1999.
5. . ., . ., . . . : , 1988.
6. . ., . ., . ., . . Turbo Pascal. : , 1998.
7. . . .: , 1988.
8. . ., . . .
. .: . ., 1991.
9. . . . : "", 1997.
10. . . .: , 1987.
11. . . . .: , 1997.
12. . ., . . Turbo
Pascal 7.0. : -, 1995.
13. . Delphi. .: , 2000.
14. . . Turbo Pascal . .: , 2000.

492

15. . . Turbo Pascal 7.0 Delphi. .:


-, 1999.
16. . . , 1999 ( ).
17. . . Delphi, 1999 ( ).
18. . . . - 7.0 .:
ACT, 2000.
19. . A. Turbo Pascal. . .: , 2002.
20. . A. Turbo Pascal. . .: , 2002.
21. . ., . . Turbo Pascal 7.0. . .: , 2003.
22. . ., . ., . .
Turbo Pascal 7.0. . .: , 2002.
23. . ., . . Turbo Pascal 7.0. , . .: , 1994.
24. . . . . . .: , 2001.
25. . Borland Delphi 6, 2001 ( ).
26. . . Turbo Pascal 7.0. . .: BHV-, 2000.
27. . . -. .: -
"- ", 1992.
28. . 3. . .: , 2000.

D
Delphi:
0 276
0 279
0 487
0 259
0 258
0 257
0 281
0 276
0 489

11
0 13
0 13
14
36

479

67, 335
166, 223, 389

0 261
0 258, 282

Turbo Pascal:
0 475
0 30
0 33, 483
0 481
0 24
0 2

117

3
, 228

18

ASCII 128
37, 65

494
18, 47, 186
37
129

227
150
0 145
0 145
0 145
0 154
101
233
0 235
0 234
50, 340
0 184
0 186
0 340
0 183
0 185
0 186
0 183

258
0 , MainMenu 355, 361
0 , RadioGroup
303
289
0 288
0 295
0 290
0 , Button 291
0 339, 381
0 , Memo 346
0 , Label 288
0 259
0 , Panel 305
0 , ,
RadioButton 304
0 288
0 , Image 306
0 258, 283, 290, 294
259, 283, 293
0 355
0 , Timer] 379

0 , , Edit 299
0 404
0 , Shape 379
, Checkbox 367, 369
, Form 258, 282, 298, 339, 402
36
0 101
94, 376
0 56, 295, 315
0 84, 351
0 76, 345
0 , 84
0 , 80
:
0 59, 327
0 89
235
0 60, 90, 237

37, 54
0 172, 316, 382
0 37, 315
0 87
0 172, 316
0 227
0 233
0 222
0 218
130
0 138
0 37
227
0 , 210
0 , 196
0 , 203
:
0 168, 170
161
16
0 43, 287, 293, 477
0 75, 345
0 38
0 47, 287, 294,
297
224
0 57, 315, 345
0 71
0 48


52
408
0 38
0 286
0 41
0 19
0 44, 285
16
0 259
0 21
0 - 258
0 - 259
0 19
0 16
281
0 339
0 340
0 286
0 285
:
0 170
0 171
0 170
0 168

495
221
217
217
0 222
316, 336
70
130
0 138
18

95
21, 23
:
0 154
0 154
0 156
44

:
0
206
0 198, 204
0 200, 204, 210
0 196
196
210
196
0 198, 204, 210
0 229
0 195
197, 203,
210
0 196
203, 227
198, 204, 211
:
0 165
164, 165
163
0 163
Object Pascal 316,
336, 337, 369, 396, 397, 403, 409, 419
0 161
0 164

91
37
0 67, 335, 336
0 226
0 , 87

50
108, 389
0 114
0 123
0 109

178

-
'
190005, -, ., 29

.




10.00 20.00

-
.: (812)251-41-10, e-mail: trade@techkniga.com

Вам также может понравиться