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

..

( 1)

2012

Turbo Pascal N1

Turbo Pascal N1
N1
TURBO PASCAL

Turbo Pascal

:

1. Turbo Pascal

,
.
.2.

2. Turbo Pascal
F10, - Esc.
, - .
(" " " ")
, (Enter)
.
.
File , ,
,
:

New
Open
F3
Save
F2
Save as
Save al
Change dir
Print
Printer setup
DOS shell
Exit
Alt+X
1.D:\LAB_TP\LAB.PAS
2.D:\LAB_TP\LAB2.PAS
3.D:\LAB_TP\WASYA.PAS
4.D:\LAB_TP\LISTER.PAS
5.D:\LAB_TP\PRIM1.PAS

Turbo Pascal N1









DOS


Enter,
, Open F3 ..
,
.
New
NONAME00.PAS.
Open (F3)
. ,
, .
Save (F2) .
. NONAME.PAS.
. Save as
c .
Save all ,
.
Change dir ,
, .
Print .
Printer setup .
DOS shell MS DOS .
S DOS,
DOS - copy, format .
EXIT. DOS
OUTPUT, Alt+F5, Edit
.
Exit (Alt+X) - MS-DOS,
, ,
SAVE Y/N. Y.
RUN .
, .

Turbo Pascal N1

Run

Ctrl+F9 -

Step over

F8

Trace into

F7

Go to cursor

F4

Program reset Ctrl+F2 -


Parametrs

Run (F9)
, , ,
- , OUTPUT,
Edit.
Alt+F5.
Step over (F8)
, ,
.
Trace Into (F7)
. F7
.
Ctrl+F2.
Go To Cursor (F4),
,
, Edit (
).
Program reset (Ctrl+F2)
. ,
, .
COMPILE ,
.
Compile
Alt+F9
-
Make
F9
-
Build
-
Destination (Disc/Memory)
-
Primary file
-
Clear primary file
-
Information
-
Compile
. .
, ..

Make

.
Make
, , ,
.
EXE- TPU- Destination ,
.
: Memory Disk ( ).

Turbo Pascal N1

Primary file
.
Clear primary file
.
Information
, .

:
F6
.
Shift F6
.
Alt + N .

[1,2,3]
,
F1 (),
,
Esc.
Ctrl+F1.


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


:
/
/
/
/
/
/
/


/
Ctrl + W/Z
PgUp / PgDn
Home / End
Ctrl+Home/End
Ctrl+PgUp/PgDn
Ctrl+Q W
Ctrl+K n
Ctrl+Q n

Turbo Pascal N1



. 80 .



Ctrl + Q F
Ctrl + Q
Ctrl + L
Ctrl + Q [/]


,
, .



/

Ins
Enter
Ctrl + N
BackSpace / Del
Ctrl + T
Ctrl + Q Y


,
, , ..
. Shift + , , , ,
.
/









/

Ctrl+K B/K
Ctrl+K
Ctrl+Ins
Shift+Del
Shift+Ins
Ctrl+K
Ctrl+K V
Ctrl+Del / Ctrl+K Y
Ctrl+K
Ctrl+K
Ctrl+K I/U


,
, ,
..




F3
File New
F2
F10
Esc
7

Turbo Pascal N1

Ctrl+Q L
Alt+X



.
. .
Program Primer;
var
i,j :integer;
c:real;
begin
ReadLn(i,j);
c:=i/j;
WriteLn('I/J = ',C);
end.
1 0, 200-
, :=i/j.
-, :
1. RUN TRACE INTO ( F7).
. begin .
- , .. ,
.
2. F7 - begin ReadLn
..
, Edit Watch,

, Edit
.
3. Watch-, :
- Ctrl+F7, ;
- I+Enter (.. I Watch)
:
I: ;
- Ctrl+F7, J+Enter Watch :
J: ;
I: ;
- Ctrl+F7, I*J+Enter Watch :
I*J: ;
J: ;
I: .
Watch
.
c:=i/j Watch
INVALID FLOATING-POINT OPERATOR
( ).
Ctrl+F2.

Turbo Pascal N1


,
.

1.
2.
3.
4.

5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

16.
17.
18.

, , .
. .
, .
. .
, .
. .
, ,
R1, R2 (R1 < R2). Pi
3.14. .
,
(x1, y1) (x2, y2). .
, ,
(x1, y1), (x2, y2), (x3, y3). .
,
div mod. .
,
div mod. .
. ,
.
. ,
.
s1 t1 . t2 ?
, 99. .
n (n>99). .
, . .
. .
.
. . a b
.
.
. .
.
. .
. ,
m1 , m 2 , t1 , t 2 .

m1t1 m2t 2
).
m1 m2

.

.
.
2

x 3 1
y
x2 1

. ( t

19.
20.
21.
22.

10

Turbo Pascal N1

23. . .
24. n . : a - , b , c -. , .
25. .
.
1-
1

(, ,
)?
2 ? (, ,
)?
3 (, , )?
4 Turbo Pascal. .
5 . .
. .
6 . .
.
7 . .
8 . .
9 .
10 .

Turbo Pascal N2

11

N2

-
.
:
1) .
2) .
3) .

,
.
. .
:
.

, .
:
;
;
GOTO;
.

, .
:
;
IF;
CASE;
REPEAT;
WHILE;
FOR;
WITH.


, BEGIN END.
begin
< 1>
< 2>

< n>
end;
,
, .
. ,
, .
.

11

12

Turbo Pascal N2
IF

IF
.

If S
then A
Else B;
{ .}

If S then A;
{ }
:
S , ;
A , , S ;
B , , S .
IF , then, else
.
CASE
CASE .
,
. :
CASE < - > of
C1:<1>;
C2:< 2>;

Cn:< n>
Else < >
End;
1,2,,n , .
.
, ,
. ,
ELSE. ELSE ,
, END.
REPEAT
REPEAT ,
, . .
.
:
repeat
< 1>
< 2>

< n>
until S;
:
< 1>, < 2>,, < n> - ,
;
S , .
repeat until ,
until .

Turbo Pascal N2

13

WHILE
WHILE () ,
.
:
WHILE <> DO < >;
- , .
.
true , .
false , WHILE
. ,
.
FOR
, ,
FOR, .
:
FOR < >:=Start TO Finish DO <>;
FOR < >:=Start DOWNTO Finish DO < >;
Start Finish
;
FOR DO ;
<> - .
.
.
Start Finish . <
>:=Start. .
1) < ><=Finish TO < >>=Finish
DOWNTO.
2) , FOR <.>,
, FOR
.
3) < > +1 TO 1 DOWNTO .1.
, .
.

,
. , , , ,
, . :
WHILE, REPEAT FOR.

.
:
.

13

14

Turbo Pascal N2

1. , ,
.
2. y

x

x2

.
3. M 1 x sin y , M 2 y cos x , x y M 1
, M 2 - .
4. , , ,
.
5. , .
6. ,
: , , , . .
7. , , =52 7+2
(,b).
8. 1000 ,
.
9.
, .
10. a+bc, a,b,c .
2
2
11. a b ?

12. a, b, c . ,
.
13. , a [b, ]. .
y cos x , x 0

14. y x sin x , x 1

2
2
y x sin x , 0 x 1

x a,

15. , . x b,
x c;

16.
y x 2 , x 10

y , x 10
3

y x 2 x 2 , x 10

17. , , . A B C .
.
18. , a, b x2 + y2 = r2,
.

Turbo Pascal N2

15

19. : x, y, z.
, ;
.
20. .
, 0. , 1.
, OX OY,
2 3.
21. : a, b, c. ,
(b c) a, a.
22. , 1 9999.
" ", " "
..
23. , 999 999.
" ", " ",
" " ..
24. x, y, z ,
.
25. , a, b, c .

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

1 200, s
(s ).
, k (k ).
1 200, 5 .
100 300, k (k
).
2
3
n n
a n (> 0). 1 a a a ... (1) a
a (> 1). n,
1

7.

a (> 1). n,
1

8.
9.
10.
11.

12.
13.
14.
15.

1
1
...
2
n a, .
1
1
...
2
n a, .

.
.
, .
,
. (
.).
, N ,
, .
, N ,
, 3
(1
= 2,5 ) 1 20 .
N . , .

15

16

Turbo Pascal N2

16.

17.
18.
19.
20.
21.
22.
23.
24.
25.

.
1
1
1
s (1 2 )(1 2 )...(1 2 )
1
2
n
, 4 3,
5 - 4, 6 5.
30 3000, , 5
7.

.
n.
, , , b (
b ).
, 1 2,
2 3, 3 4, 4 5.
n . ,
r (,b).
=32+4,
[,b], x 0,1.
, 1.
.

1, 1

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

2-
1
2
3
4
5
6
7
8

? ?
, ?
, ?
? ,
?
, IF?
CASE IF? 7.
CASE?
? WHILE REPEAT?
FOR?
?

Turbo Pascal N2

17


, N.
( :
.)
.3.

Turbo Pascal
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.

Program Prost;
Var
N,i,j: integer;
Flag:boolean;
begin
Write(' - ');
Readln(N);
i:=2;
repeat
flag:=false;
j:=2;
repeat
If i mod j = 0 then flag:=true;
j:=j+1;
until j>i-1;
if flag = false then Writeln(i, ' ');
i:=i+1;
until i>N;
end.

. :
01 ;
02-04 ;
05-19 ;
06-07 ;
10-11 ;
09-18 ;
12-15 ;
13 ;
16 ;
19 .

17

18

Turbo Pascal N2
1-5

6-7

I:=2

10-11

flag:=false
I:=2

13

I mod J = 0

Flag:=true

14
1

J:=J+1

15

J >I-1

flag:=false

16

I -
17

18

I:=I+1

I >N

.3.

19

Turbo Pascal N3

N3
-
-
.
:
1) .
2) .
3) .


,
. , , , ,
, . :
WHILE, REPEAT FOR.

.
:
.


,
.

i
i 1 i 1

1 tg ( Z )

F
2

5 Z 2 X 2 XZ 4

F 3 X

Z
5 X
Z
i
i 1
M

F 5 Z 2 X 2 XZ 4 MXZ
i 1

2
XZ
F 5
e ( MX X X )
i 1 i
M

0 X 1

X 0.25

repeat

3 Z 14

Z 2.75

While

1 M 5

M 1

For

0.1 X 2

X 0.17

For

1 Z 12

Z 2.75

Repeat

1 M 3

M 1

While

0 X 4

X 0.2

While

7 Z 13

Z 1.5

For

1 M 5

M 1

Repeat

1 X 5

X 0.3

Repeat

4 Z 7. 5

Z 1.7

While

1 M 3

M 1

For

19

20

Turbo Pascal N3
0.1 X 2.5

X 0.4

For

1 Z 7. 3

Z 3.1

Repeat

1 M 5

M 1

While

0.1 X 2.1

X 0.2

While

7 Z 13

Z 1.5

For

1 M 4

M 1

Repeat

0.1 X 0.5

X 0.1

Repeat

0.2 Z 0.6

Z 0.1

While

1 M 3

M 1

For

1 X 5

X 0.5

For

4 Z 19

Z 1.5

Repeat

1 M 5

M 1

While

1 X 3.4

X 0.2

While

1 Z 7.0

Z 1.5

For

1 M 3

M 1

Repeat

0.1 X 1.7

X 0.2

Repeat

0.5 Z 1.5

Z 0.5

While

1 M 5

M 1

For

1 X 21

X 2

For

0.5 Z 2.5

Z 0.5

Repeat

1 M 3

M 1

While

0.1 X 1.5

X 0.2

While

0.5 Z 2

Z 0.3

For

1 M 5

M 1

Repeat

0.1 X 4.1

X 0.2

Repeat

4 Z 10

Z 1.5

While

1 M 3

M 1

For

0.7 X 1.7

X 0.25

For

( Zi i)

0.2 Z 3.4

Z 0.4

Repeat

i 1

1 M 5

M 1

While

0.4 X 2.8

X 0.2

While

i )

7 Z 8

Z 0.5

For

F i 1
(X Z)
1 e

1 M 5

M 1

Repeat

M i 1
F 7 0.5 Z 2 X 2 XZ
i 1 i 1

F
7

10

iX
cos( X ) / sin( Z )

i 1 1 X 2 i

XZ

M
Xe
Z

X X 0.3
5 X i 1
i

F
2
M
2
Z
3X 2Z XZ 7 ZX Z X - X X 0.3
i

i 1
M
X
F
5 XZ
i
1 X 2 XZ i 1

M
X

F 1 arctg

3
1 X Z i 1

Z i

M
F 5 Z 2 XZ 3 Z 2 XZ
i 1

11

F
12

1 X 2 ZX

5 Xi i
i 1

Ln X Z 3 Z * X
M

i 1

13

iZX

F 5 Z 2 Cos ( XZ ) 3 1 Sin( XZ ) Tg (
i 1

14

15

Z 2 Sin( X ) 2Cos ( X ) Sin(Z ) Cos ( X )


M

(i

X
)
Z i

21

Turbo Pascal N3
16

F
17

21

22

While

3 Z 14

Z 2.75

For

1 M 5

M 1

Repeat

X 0.1

For

Z 0.1

Repeat

M 1

While

1 X 5

X 0.5

While

4 Z 19

Z 1.5

For

1 M 5

M 1

Repeat

1 X 3.4

X 0.2

For

1 Z 7.0

Z 1.5

Repeat

1 M 3

M 1

While

0.1 X 1.7

X 0.2

For

i 1

0.5 Z 1.5

Z 0.5

Repeat

1 M 5

M 1

While

1 X 21

X 2

While

0.5 Z 2.5

Z 0.5

For

1 M 3

M 1

Repeat

0.1 X 1.5

X 0.2

Repeat

Z 0.3

While

M 1

For

0.1 X 4.1

X 0.2

For

4 Z 10

Z 1.5

Repeat

1 M 3

M 1

While

0.7 X 1.7

X 0.25

While

0.2 Z 3.4

Z 0.4

For

1 M 5

M 1

Repeat

0.4 X 2.8

X 0.2

For

7 Z 8

Z 0.5

Repeat

1 M 5

M 1

While

Z X M 4

0.1 X 0.5

X eX Z M
sin(Z)
X
X 0.5

5 X i1
i
0.2 Z 0.6

F
1 M 3
M
2
2
sin(Z)
2
Z
Z
7
ZX
- X
X 0.5
3X
XZ
X i
i

20

X 0.25

M
1 ctg ( Z )
i 1sin( i 1)

18

19

0 X 1

e X Z

1 X 2 ln( X Z )

(X Z)
i

i 1

M
X
F 1 ctg
Z i 2
1 X 3 Z i 1
F 5 sin( Z 2 XM ) 3 cos(Z 2 XZ ) M iZX

M
X Z
F
5 Xi i
1 X 2 ZX
i 1

Z * X
F tg X MZ e
0.5 Z 2
M
M

sin

i
1 M 5
i 1
3

23

5 5

3 X 1

F Z Cos (X Z) e

24

25

Z 2 Sin ( X ) 2Tg ( X Z )

M 2 !

(i
F

X Z

i )

i 1

1 M

(X Z)

M2
Ctg(
)
Z i
i1
M


.
.
21

22

Turbo Pascal N3

1) Turbo Pascal :
- Ctrl+K P.
2) Norton Comander. Turbo Pascal,
, , F5, PRN
( ) Enter.
. ,
( , )
:
-
var
Rezultat:text;
- ,

begin
Assign(Rezultat,'Rez.dat');
Rewrite(Rezultat);
- Write Writeln,
Rezultat
Writeln('X=',X:8:6,' Y=',Y:8:6);
Writeln(Rezultat,'X=',X:8:6,' Y=',Y:8:6);
- ,
Close(Rezultat);
,
Assign. Norton Comander, .

23

Turbo Pascal N3

F 7
1 X 3,

X 0.5,

ZX 2 Z 2 X 4 M
Z
X
ZX
i
i 1

0 ZX 10,

Z 2.5,

1 M 5,

M 1 .

Turbo Pascal
1. Program Laba2_Var0;
2. Const
3.
X1 = 1; X2 = 3; dX = 0.5;
4.
Z1 = 0; Z2 = 10; dZ = 2.5;
5.
M1 = 1; M2 = 5; dM = 1;
6. Var
7.
k, i, M :integer;
8.
X, Z, F, S :real;
9.
Rezultat:text;
10. begin
11. Assign(Rezultat,'Rez.dat');
12. Rewrite(Rezultat);
13. K:=1;
14. x:=X1;
15. repeat
16.
Z:=Z1;
17.
repeat
18.
M:=M1;
19.
repeat
20.
S:=0;
21.
For i:=1 to M do S := S + X - Z/i;
22.
F:= S + Exp(1/7*Ln((Z*X*X+Z*Z*X+4)/(X+Z)));
23.
WriteLn(k:2,'. X=',X:2:1,' Z=',Z:2:1,' M=',M:1, F=',F);
24.
Writeln(Rezultat,k:2,'. X=',X:2:1,' Z=',Z:2:1,' M=', M:1,'F=',F);
25.
k:=k+1;
26.
M:=M+dM;
27.
until M>M2;
28.
Z:=Z+dZ;
29.
until Z>Z2;
30.
X:=X+dX;
31. until X>X2;
32. Close(Rezultat);
33. end.

23

24

Turbo Pascal N3

. ::
01 ;
02-05 ;
06-09 ;
10-33 ;
11,12 ;
14 ;
15-31 ;
16 Z;
17-29 Z;
18 ;
19 - 27 ;
20 S;
21 S = S+X-Z/i;
22 F X, Z, M;
23 ; 24 - ;
26, 28, 30 - X, Z, M;
27, 29, 31 - ;
32 ;
33 .

1. =1.0
2. =1.0

50. =1.5
51. =2.0

125. =3.0

Z=0.0
Z=0.0

Z=10.0
Z=0.0

Z=10.0

M=1
M=2

M=5
M=1

M=5

F= 2.2190136542E+00
F= 3.2190136542E+00

F= -1.3856147047E+01
F= 3.1040895137E+00

F= -6.2053482925E+00

3-
1. .
2. , ;
3. , IF;
4. , CASE;
5. , REPEAT;
6. , WHILE;
7. , FOR;
8. , WITH.
9. ?
10. , .
11.

25

Turbo Pascal N3
3

1. K=125

2. K=180

3. K=525

4. K=126

5. K=105

6. K=220

7. K=75

8. K=495

9. K=195

..
9
10
49
50
124
125
9
10
49
50
179
180
9
10
49
50
524
525
9
10
49
50
125
126
9
10
49
50
104
105
9
10
49
50
219
220
9
10
49
50
74
75
9
10
49
50
494
495
9
10
49
50
194
195

-0.30756
-0.55826
7.19976
9.30149
7.11838
9.19635
0,97242
0,34577
0,73282
1,38770
1,75714
2,53989
19,10810
22,17707
29,34174
34,38,22
40,50492
48,71211
0,08387
0,55975
5,93788
0,52858
24568,88448
190,44629
-0,06843
-0,73510
-0,23783
-0,90451
0,31619
0,35047
-0,93310
-0,11843
-1,12792
-0,79887
-1,17141
-1,17126
-0,41449
-0,38135
1,49530
1,2453
2,57363
2,27363
0,21715
0,22117
0,10527
0,10722
0,11898
0,12118
3,31208
3,68417
1,46711
1,51901
5,37688
6,52491

10. K=135

11. K=165

12. K=240

13. K=315

14. K=225

15. K=195

..
9
10
49
50
134
135
9
10
49
50
164
165
9
10
49
50
239
240
9
10
49
50
314
315
9
10
49
50
224
225
9
10
49
50
194
195

3,10919
3,71572
1,77229
1,94606
-0,33258
-0,33258
0,13827
0,03886
0,00978
0,01703
0,00066
0,00152
-0,08632
-0,10527
0,068816
0,04669
0,03162
0,01375
1,06606
1,16604
1,42011
1,62282
2,61542
3,27879
0,11628
0,07752
0,07045
0,04696
0,25911
0,17274
16783483,545
2931985864500,0000
3129261,7941
244489223970,0000
4631709,12570
1809680998300,0000

25

26

Turbo Pascal N3
1

2-10

14
16
18

21


X1:=1; X2:=3; dX:=0.5;
Z1:=0; Z2:=10; dZ:=2.5;
M1:=1; M2:=5; dM:=1;
X:=X1
Z:=Z1
M:=M1
I=1,M,1
S=S+X-Z/i

22
23,24
26

27

28
29

30

F:=S+Exp(1/7*Ln((Z*X*X+Z*Z*X+4)/(X+Z)))

M:=M+dM
M>M2

Z:=Z+dZ
Z>Z2

X:=X+dX

31

X>X2

33

.4.

Turbo Pascal N4

27

N4

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

,
. - , .
.
. .
.
.
, . :
Array[ ] of ;
:
Var
V:array[1..3] of real;
real,
: V[1], V[2], V[3].
:
LongInt;
65520 ;
,
.
,
.
.

,
.

57
.

27

28

Turbo Pascal N4
.4.


Max_El:=Matr1[1,1]

I=1,M

I=1,M

J=1,N

J=1,N

Max_El<Matr1[i,j]

Matr1[i,j]
Max_El:=Matr1[i,j]

I=1,M

I=1,M

J=1,N

J=1,N

Matr1[i,j]>=0

Matr[i,j]

Matr[i,j]:=Matr1[i,j]
Matr[i,j]:=Matr1[i,j]+Max_El

.4. 3

Turbo Pascal N4

29

Turbo Pascal
1. Program Lab3_Var0;
2. Uses Crt;
3. Const
4.
Matr1:array[1..5,1..7] of integer =
5.
((1,2,3,4,-5,6,7),
6.
(7,-6,5,4,3,2,1),
7.
(3,4,5,600,7,8,9),
8.
(-9,8,7,6,5,4,3),
9.
(1,3,5,7,-9,0,2));
10. Var
11. i,j,k:integer;
12. Matr:array[1..5,1..7] of integer;
13. Max_El:integer;
14. begin
15. Max_El:=Matr1[1,1];
16. For i:=1 to 5 do
17.
For j:=1 to 7 do
18.
If Max_El < Matr1[i,j] then Max_El:=Matr1[i,j];
19. For i:=1 to 5 do
20.
For j:=1 to 7 do
21.
If Matr1[i,j] >= 0 then Matr[i,j]:=Matr1[i,j]
22.
else Matr[i,j]:=Max_El+Matr1[i,j];
23. ClrScr;
{ Crt }
24. Writeln(' ');
25. For i:=1 to 5 do
26.
For j:=1 to 7 do
27.
If J<>7 then Write(Matr1[i,j],',')
28.
else WriteLn(Matr1[i,j]);
29. Writeln;
30. WriteLn(' ',Max_El);
31. Writeln;
32. Writeln(' ');
33. For i:=1 to 5 do
34.
For j:=1 to 7 do
35.
If J<>7 then Write(Matr[i,j],',')
36.
else WriteLn(Matr[i,j]);
37. ReadKey; { Crt }
38. end.


1, 2, 3, 4, -5, 6, 7
7, -6, 5, 4, 3, 2, 1
3, 4, 5,600, 7, 8, 9
-9, 8, 7, 6, 5, 4, 3
1, 3, 5, 7, -9, 0, 2
600

29

30

Turbo Pascal N4

1, 2, 3, 4,595,
7,594, 5, 4, 3,
3, 4, 5,600, 7,
591, 8, 7, 6, 5,
1, 3, 5, 7,591,

6,
2,
8,
4,
0,

7
1
9
3
2



1. n. .
2. n. ,
. .
3. 10.
4. 10
.
5. A(n), .

.
6. A(n), .
() .
7. A(n)
8. , :
2 3. 20.
200 300.
9. , 3 9. 10.
5 500.
10. ,
2 10.
11. n. (
).
12. n (n>2) ,
, .
13.
;
14.
;
15. A(n), .
() , .

2
3


nm
,
.
nn
.
nm

.
nm

.

Turbo Pascal N4
5

6
7

8
9

10
11
12
13
14
15
16

17
18

19

20
21
22
23
24
25

31

nm

.
nn ,
.
nm
,
.
nm
.
nm

.
nm
.
nm
..
nn .
nm
.
nm .
nm
.
nn
,
.
nm
.
nm,
, ,
.
nm,
, ,
.
nn ,
.
nn .
nn
.
nn
.
nn ,
.
nm
.

31

32

Turbo Pascal N4
1
2
3
4
5
6
7
8

4- .
?
, ?
?
?
?
?
, n- ?
,
?

Turbo Pascal N5

33

N5

- ,
.

1.
2.

:
.
.

(String) -
( 255 ). .
( 1 255). ,
255.
Str:string[50]; Str:array[1..50] of char;
, ,
<> .
.
Str:='abcdef';
,
.
(. . 1). ,
: 'XS' > 'X'.
,
.
Program Prim;
Const
Mesac:array[1..12] of string[10] = ('','',:,'');
VAR
Str:string[10];
I:integer;
C:boolean;
Begin
Write(' : ');
Readln(Str);
C:=false;
For I:=1 to 12 do
If Str=Mesac[I] then C:=true;
If C then Writeln(' ')
else Writeln(' ');
End.
, .
.
Var S1, S2, S3:string;
Begin
S1:=' ';
S2:='';
S3:=S1+S2;
{S3=' '}
S3:=S3+'!'; {S3=' !'}
End.
33

34

Turbo Pascal N4
Length(S:string)
Length(S3) = 11

Concat ,
'+'.
S3:=Concat(S1,S2); , S3:=S1+S2;
S3:=Concat(S3,S1,S2); , S3:=S3+S1+S2;

Copy(S:string,start,len:integer)

LEN , START.
S1:=Copy('ABC***123',4,3);
S1:=Copy('ABC',4,3);
S1:=Copy('ABC***123',4,11);
S1='***'
S1=''
S1='***123'

Delete(Var S:string;start,len:integer) S, LEN


START.
S:='';
Delete(S,2,4); {S='CA'}
.
Insert(Subs:string; Var S:string, start:integer) SUBS
S, START.
S:='-';
Insert('-',S,8);
{S='--'}
Pos(Subs,S:string):byte S,
S Subs. S Subs,
0. Pos ,
Subs S , .. P:=Pos('noo',Boonoonoonoos'); ,
4, 7 10.


. .

.
1. , .
2. X , X .
3. . , (, ).
. ,
.
. ,
, .
4. , .
5. .
6. , .
7. .
8. .

Turbo Pascal N5

35

9.
: , .
10. .
11.
: .
12.
: .
13.
: , .
14. .
15. ,
: .
16. ,
: .
17. , ,
.
18.
: .
19. u1084
20. .
21. . ,
.
22. . ,
.
23. . ,
.
24. , <1000, ,
.
25. , <1000, ,
.

35

TURBO PASCAL


. ,

, :
Error 15 : File not found (Window.TPU)
( 15 : )
, Turbo Pascal ( )
.
,
(^) , .
, ,
. ,
, ":=" .
.
1. Out of memory ( ). ,
. :

Compile/Destination Memory,
Disk .

Options/Compiler /Link buffer


Memory , Disk.
/L.

, , SideKick
SuperKey, .

Turbo.EXE, Turbo.EXE
TPC.EXE, .
, , ,
.
.
2. Identifier expected ( ).
. , .
3. Unknown identifier ( ).
.
4. Duplicate identifier ( ).
.
5. Syntax error ( ).
. , .
6. Error in real constant ( ).
1 " ".
7. Error in integer constant ( ).
1 " ". ,
, ,
; : 12345678912.0
8. String constant exceeds line ( ).
, .
9. Too many nested files ( ).
15 . , 14 .
10. Unexpected end of file ( ).
- :

37

end .
, begin end .

.
.

.
11. Line too long ( ). 126
.
12. Type identifier expected ( ).
, .
13. Too many open files ( ).
, CONFIG.SYS FILES = xx,
. , 20.
14. Invalid file name ( ).
.
15. File not found ( ).
,
.
16. Disk full ( ). .
17. Invalid compiler directive ( ).
,
,
.
18. Too many files ( ).
. , ,
.
19. Undefined type in pointer definition ( ).
, .
20. Variable identifier expected ( ).
, .
21. Error in type ( ). .
23. Set base type out of range (
). ,
0..255, , 256 .
25. Invalid string length ( ).
1..255.
26. Type mismatch ( ). :

, ;

.
28. Lower bound greater than upper bound ( ).
.
29. Orginal type expected ( ). ,
, .
30. Integer constant expected ( ).
31. Constant expected ( ) 32. Integer or real constant expected
( )
35. Label identifier expected ( ).
, .
36. Begin expected ( begin)
37. End expected ( end)
38. Integer expession expected ( ).
.
37

39. Ordinal expession expected ( ).


.
40. Boolean expression expected ( )
41. Operand types do not match operator ( ).
, 'A' div '2'.
43. Illegal assignment ( ).


.
44. Field identifier expected ( ).
.
50. Do expcted ( ).
54. OF expected ( OF).
57. THEN expected ( then).
58. TO or DOWNTO expected ( to downto).
62. Division by zero ( ). .
63. Invalid file type ( ).
, , readln c Seek c
.
66. String variable expected ( ).
.
67. String expession expected ( ).
.
70. Unit version mismatch ( ). ,
, .
, ,
Compile/Make Compile /Build / /
.
74. Constant and case types do not match (
case ). case
case.
75. Record variable expected ( record).
record.
77. File variable expected ( file).
file.
79. Integer or real expression expected ( integer real).
80. Label not within current block ( ). goto
, .
81. Label already defined ( ).
.
82. Undefined label in preceding statement part (
).
, .
84. UNIT expected ( UNIT).
85. ";" expected ( ; ).
86. ":" expected ( : ).
87. "," expected ( , ).
88. "(" expected ( ( ).
89. ")" expected ( ) ).
90. "=" expected ( = ).
91. ":=" expected ( := ).
92. "[" or "(." expected ( [ (. ).
93. "]" or ".)" expected ( ] .) ).

39

94. "." expected ( . ).


95. ".." expected ( .. ).
96. Too many variables ( ).
97. Invalid FOR control variable (
for). for ,
.
102. String constant expected ( string).
103. Integer or real variable expected ( Integer Real).
Integer Real.
106. Character expession expected ( ).
har.
112. Case constant out of range ( case
). case 32768...32767.
140.Invalid floating-point operation ( ).

.

,
:
Run-time error nnn at xxx:yyyy ( nnn xxx:yyyy, nnn , xxxx:yyyy - ( )).
:

DOS:1-99;

/:100-149;

:150-199;

:200-255.
DOS
1. Invalid function number ( ).
DOS.
2. File not found ( ). Reset, Append, Rename
Erase, .
3. Path not fond ( ).

Reset, Rewrite, Append, Rename Erase, ,


, .

Chdir, Mkdir Rmdir,


.
4. Too many open files ( ).
Reset, Rewrite Append, .
5. File access denied ( ).
/
,
{$I+}. {$I} ,
IOResult.
100. Disk read error ( ). Read
, .
101. Disk write error ( ). Close, Write,
Writeln, Flush Page, .
39

102. File not assigned ( ). Reset, Rewrite,


Append, Rename Erase,
Assign.
103. File not open ( ). Close, Read, Write, Eof,
FileSize, Flush, BlockRead BlockWrite, .
104. File not open for input ( ). Read,
Readln, Eof, Eoln, SeekEof, SeekEoln , .
105. File not open for output ( ).
Write Writeln , .

150. Disk is write-protected ( ).
159. Printer out of paper ( ).
160. Device write fault ( ).
161. Device read fault ( ).

.
200. Division by zero ( ).
202. Stack overflow error ( ).
, {$S+},
.
$M. -
.
205. Floating point overflow ( ).
Turbo Pascal .
207. Invalid floating point operation ( ).

, Trunc Round,
LongInt (-2147483648 214783647).

, Sgrt, .

, Ln, .

8087.

Оценить