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

. .

.
.. , .. . 2003 .



.
. -
.
.
.. ..
.



... . . .
- .

, 2003.
2003 . .

1 2
Record..81

With.84
..85
.5 3.88
3.89
.5
..15 Record90
...18
.23 93
...24
...25
..29
...31
34
135
1..35
137
...38

String49
String ...52
55
..59
String....65

Set.68
2..78
279
Set .77

3 4


:
( )

.. ();
,

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

,
( ).
.
, ,

, () , .
.

LIB\TURBO.TPL
.
. ,
(BGI), ..
:
.
,
.
; ;
,
.
:


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

. ( : )

()
, var
String
,
( ).
;

5 6
: .
.
:

;



(
)

: ,
var k,l:integer ; x:real;
begin . . . . . . . . . . . . . . . . .
, was(k,l,x) ..{ }
, begin end EN end.
..
:
;
,
. .
(, FORWARD) , ,
,
.

.
, : .
procedure was( i, j:integer; var x:real);
, .
,
, ,
.
, , .
, , SQ

+ bx + c =0.
:
: , b, c : 1 , 2
1)
.
;
,
2)
( ).
.

.
.

.
7 8
,
. var- .
, ,
. y,
1) (call by value). k.
, :
, ,
. .
,
, var i,k:integer;
. procedure c(x:integer, var y:integer);
begin

writeln ( );
: x:=x+1; y:=y+1;
, writeln( ,x:4);
, . writeln ( ,y:4);
, end;
. begin
{ }
.
i:=5; k:=5;
writeln (i= ,i:4,k= ,k:4);
, . { }
, c(i,k);
writeln( );
-. writeln( i= ,i:4);
writeln( k= ,k:4);
, ,
end.
x i.
:
2) (call by reference).
(i,k); :
,
, var. begin
x:=i;
( ). begin
x:=x+1;
()
k:=k+1;
: , end;
.
end.
var - ,
. i
. i
9 10
k. i 5, k : S:=S+Amod10; K:=K+1;
6. A:=Adiv10; =0, , ,
, , . .
.

.
.
m:=1,3
. ,
S:=0; K:=0
.

3) () .

A<>0
, .
:
var ; i
S:=S+A mod 10
A:=A div 10
,

, . sumkol
, , K:=K+1
.
-

. i
:
1) ; . 1. - . 2. -
2) sumkol
.
program. quersum_bestimmung;
1: var i:word;S,K,m:byte;
3- . procedure sumkol (var K,S:byte; A:word;) { }
begin
: Sumkol ,
S:=0; K:=0;
. while A<>0 do
div mod. begin
div mod . S:=S+Amod10; K:=K+1; A:=Adiv10;
S- ; end; end;
begin
S:=S+Amod 10;
for m:=1 to 3 do begin { }
K - ; writeln ( );
K:=K+1; readln (i);
sumkol (K,S,i); { }
11 12
writeln ( ,i:6, = ,S:4); maswrite(b); { }
writeln ( = , K:4);
end; end. end.

2: 3:
b : , 20 ,
. - 15, - 10. , .
. .
,
, . , ,
.
.
TYPE.
program massiv; type mas=array [1..20] of integer;
coust n=20; var A, B, C:mass;
type mas=array [1..n] of real; ka, kb, kc:byte; {ka, kb, kc
var a,b:mass; , , }
procedure masread (var x:mas); { }
var i:integer; Procedure COL(var A:mass; n:byte; var k:byte);
begin var i:byte;
writeln( , n , ); begin
for i:=1 to n do read (x[i]); writeln ( , n, ); k:=0;
end; for i:=1 to n do
procedure maswrite(var x:mas); { } begin
var i:integer; read (A[i]); if A[i]=0 then k:=k+1
begin end; end;
for i:=1 to n do write (x[i]:8:3); begin { }
writeln; COL (A,20,ka);
end; writeln ( , ka, );
procedure rechtshift (var x:mas); { 1 } COL (B,15,kb);
var i:integer; c:real; writeln ( , kb, );
begin COL (C,10,kc);
c:=x[n]; writeln ( ,kc, );
for i:=n downto 2 do x[i]:=x[i-1]; if(ka=kb) and (kb=kc) then begin
x[1]:=c; writeln ( );
end; exit end;
begin (* *) if (ka>=kb) and (ka>=kc) then
masread(a); { } writeln ( );
b:=a; { b} if (kb>=ka) and (kb>=kc) then
writeln( ); writeln ( );
maswrite(b); { b} if (kc>=ka) and (kc>=kb) then
rechtshift(b); { b} writeln ( ); end.
13 14
, , ..
,
, . (
, . , 2).
( scope) .
1. :
.
. .

2. ,
;
,
, ,
. ;
,
. (.. ).
.
, ,
. , . 3.

. , , ,
, (), ,
. . , ,
3. .
, .
, . ,
. , PROGRAM.
,
, .
, , ,
. :
, 1. , ,
, var- .
.
,
2. (, )
,
,
, ,
.
.
, ,
.
15 16
3. , , . ,
, .
, .

. ,
(. . ), ,
, , ,
. ,
, . .
,
, , .
. ,
.
, TYPE, , .
. :
:
program T1(output);
type AB=array [1 . .3] of real;
; ;
var A:AB;
procedure Q (var B:AB; x:real);

begin .. end;
........... . ............
end.
. :
,
, ,

function :
: TYPE MISMATCH.

:
program T2(output);
var A:array [1 . .3] of real;
procedure Q;
var B:array [1 . .3] of real;
..... ..................... , ,
end. :
, .. 1.
, , . :
17 18
: if k>1 then for i:=2 to k do
p:=p*i;
fact:=p; {
}
end;
:= ; { }
begin
writeln( n m);
readln(n,m);
cnm:=fact(n) div fact(m) div fact(n-m); { }
writeln( = ,cnm);
end.
2.
. ( real), 5:
. y(x): y(x)=ax2+bx+c,
3. (.. np nt nr
) a= p(i)
i =1
b= t (i)
i =1
c=
i =1
r (i) ;
writeln.
.
: :
k


sum=
i =1
zi


(
) coust max=40;
type m=1. . max;
mas= array[m] of real;
, var i,np,nt,nr:byte;
p,t,r:mas;
4: x,y:real;
function sum (z:mas,k:byte):real; { }

var j:byte; s:real;
( n m). begin
n! s:=0;
Cm = for j:=1 to k do s=s+z(j);
n m!(n m)! sum:=s; { }
var n,m:byte; end;
cnm:longint; procedure masread (var z:mas,k:byte); { }
function fact (k:byte):longint; { k!} var l:byte;
var p:longint; i:byte; begin
begin writeln ( ,k, );
p:=1; for l:=1 to k do read (z[l]);
19 20
writeln; { } th:=r;
end; end;
begin begin
writeln ( np, nt, nr); writeln ( a b);
readln(np,nt,nr); readln (a,b);
writeln( mas p); z:=(th(a)+sqr(th(a-b)))/sqrt(th(sqr(a)-sqr(b)));
masread (p,np); writeln (z= ,z);
writeln( t); end.
masread(t,nt);
.
writeln( r);
masread(r,nr); ,
writeln( ); r .
readln(x); program funth;
y:=sqr(x)*sum(p,np)+sum(t,nt)*x+sum(r,nr); var a,b,z,t1,t2,t3:real;
writeln(y= ,y); { ; r - }
end. procedure th (x:real; var r:real);
var c:real;
6: begin
c:=exp(2*x); r:=(c-1)/(c+1);
: end;
begin
tha+th2 (a b) .
Z= writeln ( a b);
readln(a,b);
th(a2 b2 ) th(a,t1); th(a-b,t2); th(sqr(a)-sqr(b),t3);
: z:=(t1-t2)/sqr(t3);
e x e x e2x 1 , writeln(z= ,z);
thx = = end.
e x + e x e2x +1
: , ,
1) ; , - ( ), .
2) . . .
( , var-.
) x th , :
c r . 1 3,
. 4 5,
c = e 2 x ; r = (c 1) (c +1) ; th = r .
program bestimmung_th;
var a,b,z:real;
function th (x:real):real;
var r,c:real;
begin
c:=exp(2*x); r:=(c-1)/(c+1);
21 22
end;
procedure cat;
, begun
(.. ), tac(0.3,1.5);
.
, : end;
cat tac
procedure tac(x,y:real); cat
begin. , ,
cat(3,2);
. ,
end; .
procedure cat(a,b:integer);
begin ,
.. .
tac(0.3,1.5);
.
end. .
tac
cat, ..
.

,
, (, )
tac cat.
.


.
OBJ, -
,
,
FORWARD, ,
EXTERNAL. , -
.
$L,

OBJ,
,
, :
.
: procedure SqRoots(a,b,c:real); external;
. ..
procedure tac(x,y:real);forward; {$L ROOTS.OBJ}.
procedure cat(a,b:integer);forward;
OBJ
.
procedure tac; .
. ,
begin . MASM
cat(3,2);
.
23 24
. , if n=0 then fact:=1
, . else fact:= fact(n-1)*n;
end;
begin
. .
writeln( M);
, , readln(M);
. f:=fact(M);
, writeln (M= ,f);
EXTERNAL. end.
f:=fact(M),
n.
>0, fact
recurrence, -1,
, . -1 ,
: . -1.
1, 1, 2, 3, 5, 8, 13 , 21, 34,. . . . . . . . . . . . . . -2 ..
= 1, 1.
:
F[n]:=F[n-1]+F[n-2] n>2 (1) .
(1) : , program k;
, . var i:integer; perest:longint;
: n function factor(n:integer):longint;
(), var i:integer; p:longint;
begin
n ,
p:=1
. if n>1 then
n : for i:=2 to n do
Pn=n!=n(n-1)(n-2). . . . .1 p:=p*i; factor:=p;
end;
(n-1)! begin
: n!=n(n-1)! writeln( n);
readln(i);
, ( ) perest:= factor(i);
. . writeln( = ,perest);
end.
7:
8:
.

var f,M:longint;
function fact (n:integer): longint; n.
begin REVERSE.
25 26
procedure reverse (n:word); (, , , ,
begin { } ..) . ,
write(n mod 10); , .
if (n div 10) <>0 then reverse(n div 10);
end;
var i:word; .
begin
writeln( );
readln(i);
reverse(i); writeln; :
end.

RUN
351
procedure ( )

153
n=351.
write(n mod 10) output, ]351:10[=1,
if(n div10)<>0 then reverse(n div 10)
; forward ;
]351:10[=35. <>0, 35
Forward ,
reverse.
.
(n div 10) ,
, ..
35. write(n mod 10) output
forward:
35/10=5, ]35/10[=30
reverse n=3, write(n mod 10)

3:10=.3, ]3/10[=0, function

( ) :
reverse .
,
reverse .



; forward ;
,
.

:

.
.
.
, , , :
, , .
. function B(x:integer):real; forward;
: function A(y:integer):real;
. var I:integer;
begin
27 28
. . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .
A:=B(I)+3.5 .
end; .
function B;
var D:integer; LIFO (Last In First
begin . . . . . . . . .. . . . . . . . . . . . . . . . . . . . Out), ..
B:=A(D)-1.8 .
end;
. ,
, , ,
,
, .
, $
. . 1024 ,
65536 , = 16384 .
. $M . 3
:
1 ,
2 3
( - Heapsize), :

. {$M 10240, 0, 200000}
. , {$M 1024, 0,0}
, {$M 16384, 1024, 65000}
. , , 100
, 100 ,
. . 0, .
. . ,
(
) , ,
, 65536 64 . .
. :
, {$M 16384, 0,655360},
, . .. 16 ,
, .
, , ,
. Options/Memory Sizes

29 30
recursion writeln(i:30)
. , i<1
writeln(i:3). n 1,
writeln(i:30) n,n-
1,,1, writeln(i:3) 1,2,..,n
( LIFO , ).
procedure proc(i:integer);
begin
1 program iterativ_recursion;
if then proc(i+1); var n:integer;
2 procedure recursion(i:integer); {}
end; begin
writeln(i:30);
proc(1) , proc if i>1 then recursion (i-1);
proc(2), proc(3), . . . , writeln(i:3);
true. false ( ), end;
proc(i+1), procedure cike(i:integer); {}
2 ( ). var k:integer:
begin
. , , proc(10) , for k:=1 to i do write(k:3);
2 , end;
, .. proc(10), proc(9), ., proc(1). begin { }
, writeln( n);
. readln(n);
write( : );
. proc
cike(n); writeln;
, . writeln( : );
, . recursion(n);
- , end.
:
1. ( 10:
); convert z
2. .. 8
9: .
program dezimal_oktal_konvertierung;
var z:integer;
. k procedure convert(z:integer); {
. 1 n }
, - . , begin
. if z>1 then convert (z div8);
write (z mod 8:1);
end;
31 32
begin for n:=1 to k do begin
writeln ( : ); writeln(: ,fibit(n):5);
readln(z); writeln(: );
writeln( : ,z:6); writeln(!#!=!#);
writeln( : ); write( : );
convert(z); result:=fibrek(n);
end. writeln;
write(result);end;
11:
end.
. n
(.. , f[1] f[n]),
(1). , ,
. . .
program fibonacci(input,output); :
uses crt; {uses 7, 11,
} . 8 10,
function fibit(n:integer):integer; { }
var a,b,c,i:integer; .
begin
a:=1; b:=1;
if (n=1) or (n=2) then fibit:=1 else
begin
for i:=3 to n do begin ,
c:=a+b; a:=b; b:=c;
end; { for} , ,
fibit:=c; .
end; { else} ,
end; { } ,
function fibrek(n:integer):integer; .
begin

write( ); delay(300);
program sideffect;
{ delay
var a,z:integer; {a,z- }
0.3 .}
function change(x:integer):integer;
if (n+1) or (n=2) then fibrek:=1
begin
else fibrek:=fibrek(n-1)+fibrek(n-2);
z:=z-x; { }
write (chr(8), chr(8)); delay(300);
change:=sqr(x);
{chr(8) Backspace}
end;
end;
begin
var k,n,result:integer;
z:=10; a:=change(z); writeln(a, :3,z);
begin { }
z:=10; a:=change(10)*change(z);
clrscr; { }
writeln(a, :3,z);
write (k=?);
z:=10; a:=change(z)* change(10);
readln(k);
33 34
writeln(a,z); 4. , ?
end.
: 5.
100_ _ _0 ?
100_ _ _10
0_ _ _0 6.
.
,
7. ,
.
,
.
1
, , 8.
, - . . ,
;
, . ?
" " ?
, :
program GL;
1. var A,B:integer; :char;
, . procedure p;
2. . var A,X :char;
begin . . .A:=B; X:=C; C:=A;
B:=B+1;.end;
.
begin { }
, WRITELN(). A:=0; B:=200; C:=&;
, p; { }
. , . ( writeln (A= ,A, B= ,B, C= ,C);
) end.
,
.

1

?

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

35 36

1
, , .
.

. ,
.
1 32
.
1. 1(6), 2(7), 3(4), 4(6).

.
.
2. (7), (4), (12). ,
.

.
3. 1(5), 2(7), 3(7).
.
.
4. (7), (4), (9). ,
.
.
5. 1(7), 2(9), 3(5), 4(6). ,
.
.
6. (8), Y(7), Z(9).

.
.
7. (5), (7), (6). ,
, 3.
.

37 38
8. (10) (7). , 8; , 1, 3, 7, 8, 9?
. .
. : k , n
9. (3,4), (2,7), (3,4). , 2 ( 0),
. n! ,
A nk =
2 ( n k )!
. .. n k.
k
10. (5), (4), (7). , A kn . A n
, 1 +1.
,
1 +1 .

11. (5), (7), (10). n
A nk = i .
i = n k +1
. (, ).
.
19. 5
12. 1(7), 2(6), 3(4). 8 ; 10 ; 11 ?
. .
. k
: k n C n ,
13. X(10), Y(7), Z(5).
n! ,
, 5, . C nk =
, 5, k !( n k )!
. k
C n - n k.
14. (7), (9). , k
C n :
.
n
.
i
15. (5), (11). ,
Cnk = i = n k + 1 .
. k!
. , .
16. (10), (8), (6). , 20. 3 .
. , 2 ; 4 ?
. .
17. (34), (42), (43) (35). : , k
* *. , :
. 3k e 3 .
P(k ) =
18. : , k!
1, 2, 3, 4, 5; , 2, 4, 6,
39 40
. =6 . =18 .
21. .
. 10 / : ,
() 1
/. 9 / 2 . , ( f (x) ) :
1.6 /. , f ( x) = ( a 2 x) 2 x = 4 x 3 4ax 2 + a 2 x ma x
x
1 ; 4 .
. , (
df =0) :
: dx
df
S=10t+0,5t, S=9t+0,8t, S = 12 x 2 8 ax + a 2 = 0 .
dx
, t .

f (V , a, t ) = V t + a t 2 2 ,
. ,
t. :
. :
22. , d2 f
. <0
dx 2
.
25. ,
: (
) 0,3t-t=0. V0 , :
. x = V0 t cos ,
23. , k , l . y t2
r . , y = V0 t sin
2
s . k=10, l=5, r=4,
x = 2. ,
s=2 k=10, l=4, r=5, s=3.
m . = 2/6, V0 = 35 / = /4, V0 = 30
n .
: P : /. .
: t,
Cls C kr ls 2
P= . gx
y = y ( x ) = x tg .
C kr 2
2V 0 cos
2

m , x = 0, x = 2 y ( x )
C n . 19.
y ( x ) <0. , ,
24. .
: . g = 9,8 /.
. ! ,
, ? , .

41 42
26. , b c (.. 29.
, b c). 1 20 /.
, . 1 ; 3 ; 4 ? .
: = 3, b :
= 4, c =5; a = 2, b = 37 , c = 37 . g t2
h(t ) = h0 + V0 t ,
. 2
: , h0 , V0 , t , h(t )
b c :
t . g = 9,8 /.
S= ( ) ( b) ( p c ) , h(t ) .
p , .. p = ( a + b + c ) 2 . .
30. , 5,
. 10 . .
27. , . : , h,

, . g t2
: (1;1),
V0 t + ( h h0 ) = 0 .
2
(4;2), (2;3,5); (1;2), (4;1), (3;3,5). . ,
.
. 31. , P1(x) = x4+2x3
: , P(x1,y1) Q(x2,y2), 4x+3 x+3 P1(-3); P2(x) =x5+6x37x+2 x2
P2(2).
2 2
|PQ| = ( x 2 x1 ) + ( y 2 y 1 ) . .
26. : n
a0xn+a1xn-1+ . . . +an x-c,
28. , .
b0xn-1+b1xn-2+ . . . +bn-1 r
, ,
b0=a0, bk=cbk 1+ak, k=1, 2, . . . ,n1, r=cbn 1+an.
, .
= r.
: (1;1),

(5;2), (3;3); (2;5), (4;3), (6;4).
.
.
.
: , A(x1,y1),
,
B(x2,y2) C(x3,y3) :
.
S = 1 | (x2 x1)(y3 y1) (x3 x1)(y2 y1) |.
2
32. Pn ( + 1) Pn ( ) ,
.
Pn = a0 x n + a1 n1 + ... + n1 + n
43 44
=1; 3; 5. , 19 1.
, . .
33. 35. , , 6 ,
x +6x +3x45x3 x9-7x5+3x42x2+23.
7 6
. 0,51
r n 0,49. , n m (m<=n),
. .
: n a0xn + a1xn-1 + . . . + an, : 34. ,
r b0xn - r + b1xn r -1 + . . . + bn - r k ,
: , , 1
r =1 , 2 , .. k ,
bk= ak ( n k i ) , k=0, 1, . . . , nr.
i = 20
.
.
36. x8+2x7+3x67x453
. 27 3 =3.
. x7x6+2x52x413 +4
= -4.
2 .
.
. .
1 . : 31 33 1 .
. 37. 29 1 0,25 ,
34. , 4 .
; ; ; ; .
; . , .
. : h(t )
. (. 30 1),
. h(t ) [0:4] 0,25.
. , .
: =0,5, q=1-p.
, , n , m , i ,
m n-m
Cm
n p q . 0,25 i .
. , 38. Q
( Z). ,
, , , , .
( ). C m
n . ,

45 46
. ,
. Q(4,5), Z(7,5), A(2,4), B(4,6), C(2,6) Q(5,4), Z(5,7),
. Q(4,5), Z(7,5), A(2,4), B(5,5), C(3,6) Q(5,4), Z(5,7), A(5,3), B(3,5;4,5), C(5,6).
A(3,3), B(7,5), C(5,6). .
. :
: . ,
, Q Z, .. .
(. 27 1). 37.
(. 28 1). , 42. 25 1 5 ,
. 1 .
39. 29 1 0,25 , ,
= /4 V0 = 30 /.
4 .
. . .
. :
: V0 qt (. 29 g t2
y (t ) = V0 t sin
1). ( 2
) [0:4] 0,25. 37 2- .
i (
43. 5 .
). t* t* = 0,25 i,
0,6. ,
h(t*).
; 1 ; 2 ; 3; 4 ;
.
5 . , .
40. 21 1 0,25 ,
5 .
. . :
. 0,6, q=0,4. ,
: m n-m
n m , m
n p q . .
, ..
34.
( a1 a2 )t 2
y (t ) = (V1 V2 )t + 44. 43 ,
2 3 . m n
(. 21 1). .
, 39. .
41. Q : . 43 35.
( Z). , 45. , , .
, , . 10-4 ,
. , . , .
,
47 48
(1,1), (4,2), (2,3) (3,2 ,
(4, 1), (5,3). (
. 0 20 ).
. := ,
: INPUT .
M1(x1, y1), M2(x2, y2) M3(x3, y3),
x:=;
( M( x m , y m )) : A:= ';
x1 + x 2 + x 3 y1 + y 2 + y 3 x:=A; readln(A);
xm = ym =
3 3
. 28 1. .
. , , 20
STRING (1 1 ) 21 ,

string. ( chr(13)),
, . 20 .
, :
, .
string ,
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
.
13

. :
string: .
, ,
string [ ] ; , ..
.
0. . 255 ,
. , .
. .
, 255 . I:=4;
: writeln (A[3] , , A[I]; , A[I+4], = ,ord(A[0]));
type str = string [20];
:
var x,A: str; z: string [32]; k:string;
___ =13

, .

49 50
. .
, , , .
LENGTH(A). ,
.
char, .. : ,
var c:char; S:string; ,
begin .
S:=tag
c:=S[1];
.
c:=x; S[2]:=c;
:
Pascal = pascal false
1. (). +.
+ < - true
Pas_ _ _ > Pas true
, 255
.
var x,y:string[6]; z:string[12]; ,
begin .
x:=Turbo; y:=Pascal;
z:= x+ +y;
writeln(z); String
end.
: Turbo Pascal.
:
z:=;
:
z:=; procedure das (x:string[10]);
:=z; procedure das (x:string); -
writeln(); string[255].
:
:
type st = string[10];
, . procedure das (x:st);

2. . .. ,
: <, >, =, <=, >=, < >. .
. . :
{$V} VAR .
. V+ ()
, V ,
( ), , , string. V+ ,
51 52
string , {*$V-*}, ,
. .
V- . dies ,
, , 10
:
.
{*$V - *} { , ,
dies jenes } ,
program; { }
string ( )
type w = string[10];
var a:string[20]; {$V-}.
procedure das( x:w); .
begin

writeln(x ,_ _ _ :, ord(x[0]):5);
end; , , :
procedure dies(var x:w); Function xstr(S:string[32]):string[6]; - !
begin
writeln(x ,_ _ _ :, ord(x[0]):5); :
end; Type str1 = string[32];str2:= string[6];
procedure jenes(x:string);
begin Function xstr(S:str1):str2;
writeln(x,_ _ _ :, ord(x[0]):5); FILLCHAR
end;
- .
begin
writeln( 15 :); var S:string;
readln(a); begin..
writeln(a,_ _ _ :,ord(a[0]):5);
fillchar (S[1],80,*); S[0]:=chr(80);end.
das(a); { }
dies(a); { } S[1] , .
jenes(a); { } .
end. 1 80 (*).
, ,
. , .. S[0]
.
. , ,
10 .
{*$V*} . - .
Fillchar
. , ,
{*$V+*} type . ,
mismatch( ). .

53 54

, :
1. Length(S:String) S.
1. . , Ord(S[0]),
: .
2. Concat .
Chr(x:byte):chr ASCII
.
Ord(C:char):byte
Pred(C:char):char +, .
Succ(C:char):char :
UpCase(C:char):char a. .z . var S, S1, S2:string;
begin
S1:=; S2:=;
writeln(concat(S1,S2));
end.

:
S:=S1+S2;
writeln(S);
2. . Concat
, .

Length(s:string):byte
3. Copy(S:string;Start,Len:byte)
Concat(s1, s2, . . .,sn):string s1. . .sn Len , Start. Start
Copy(S:string;start, len:integer):string len, S, , Len ,
- start Star S, S
S. Start .
Delete(var S:string; start, len:byte ) S len,
:
start
S. var S1, S2, S3:string;
Insert(Subs:string,var S:string; S Subs, begin
start:integer) start. S1:=ABC***123;
Pos(Subs, s:string):byte writeln (copy(S1,4,3)); { ***}
Subs S S2:= copy(S1, 10, 2);
Subs S 0, writeln(S2); { }
S Subs. writeln(copy(S1, 2, 5)); { ***}
Str([:F[:n]];var S:string) end.
S. 4. Delete(VAR S:string; Start,Len:Byte)
. . S, Len ,
Val(S:string;var x; var ErrCode:integer) S
Start:
( )
. S:=;
Delete(S, 2, 4); writeln(S); { }
55 56
. , .
Start=0 S, . .
Len=0. Len, ,
, Star S. . Width ,
: ( ),
Delete(S, 16, 255) Width.
S 16 Width. ,
, 15 . .
5. Insert (Subs:String; VAR S:string; Start:byte ) :
, Delete. Subs := -6; := 1.18822-2;
S, Start. Str(A:4,st1); { st1=_ _ -6}
Str(B:8:5,st2); { st2=_1190}
S:= ;
Str(6.66:6:0,S); { S=_ _ _ _ _ 7}
Insert( , S, 8); , ,
Writeln(S); , .
{ S = } Width ,
S , , :
S ( , Str(6.66:-8:1,S) { S = 6.7}
). 8. Val(S:string; VAR V; VAR ErrCode:Integer)
Start S, S
Subs S. V. ,
Start . ErrCode , S,
6. Pos(Subs, S:string):byte . V
Subs S. S, S. S +nn, V
S Subs. S , .
Subs, 0. : S= 60000, V
byte, ?
var S:string; N:byte;
S:= ; .
N:=Pos(_, S); ( $R+);
Writeln(N); { N=14} , .
, ( $R-); V:
Subs S , Longint, ErrCode<>0, V
S, . . V Longint, ErrCode
7. Str(x[:Width [:dec]]; VAR S:string) ( 0), V
. , , , S. ,
Craph:OutText(S:string) V
S , OutTextXY(x, y:integer; S:string) longint.

57 58
{$R-} var L:longint; w:word; errc:byte; S:string[10]; 13:
begin
.
S:=125375;
w:=0; { w} *.
val(S,L,errc); { }
if errc= 0 then begin
if (L>=0) and (L<=65535) then { }
w:=L
else writeln( ,L); t *,
end {then}
else writeln ( ,S, ,S[errc]); end.
t:= t + *

P:=pos(*,t)
12:
SL1 SL2.
P<>0
: SL1 t.
var t:string; SL1, SL2:string[20];
p:byte; L1, L2:byte;
begin writeln( ); readln(t);
t
writeln(SL1); readln(SL1);
L1:=length(SL1);
SL1,
SL2 writeln(SL2); readln(SL2); var t:string; L, p:byte;
L2:=length(SL2); P:=pos(*, t)
begin readln(t);
p:=pos(SL1,t) p:=pos(SL1,t); t:= t + *; L:= length(t);
while p<>0 do begin delete(t,p,L1); p:= pos(*, t);

{ SL1 } while p<>0 do

insert(SL2,t,p); {. SL2 } begin writeln(copy(t, 1, p-1);
p:=pos(SL1,t);
P<>0 . 6 - 13 delete(t, 1, p);
end; { t:=copy(t, p+1, l-p)};
writeln(t); end.
p:=pos(*, t);
end; end.
SL1 SL2
. . t 14:
:=pos(SL1,t)
, , 50
. .
: t ; d ; L ;
.5. - 12 p ; a 50- .
59 60
15:
,
. .
t : t ;
p {0 , 1 };
t:=t+_ b ;
d:=length(t)
h ;
i ;
L .
d>50 t
:

160175; - 224239;
p:=pos(_,t) - 128159.
a
var t:string; b:char; i,L,p,h:byte;
begin
a:=_, L:=0
readln(t);
t:= t+_;
a L+p<=50 L:= length(t);
p:=0;
for i:=1 to L do begin {:
a:=a+copy(t, 1, p) }
L:=L+p var a,t:string; L,d,p: byte; if (ord(t[i])>=128) and (ord(t[i])<=175) or
delete(t, 1, p) (ord(t[i])>=224) and (ord(t[i])<=239)
begin writeln ( );
p:= pos(_, t) then begin
d:=d-L readln(t);
d:=length(t); if p=0 then begin
t:=t+_; p:=1;
while d>50 do begin b:= t[i]; { }
h:= i; { }
a:=_; L:=0; p:=pos(_,t);
end;
.7. - 14 while L+p<=50 do begin
end
a:= a+ copy(t,1,p);
else begin
L:= L+p; d:=d-L;
if p<>0 then begin
delete(t,1,p);
if b= t[i-1] then
p:= pos( ,t);
writeln(copy(t,h,i-h); { }
end;
end;
writeln(a);
p:=0;
end;
end;
writeln(t);
end;
end.
end.

61 62
17:

.
.
t

1
t:= t + _
L:=length(t) 1

L:=length(a)
p:=0
k -- , t:=copy(a,1,1)
1
copy(t,h,i-h)
i:=1,L k:=0

t=a

b=t[i-1]
a:= a +_
(ord(t[i])>=128) and k:=k +1
p:=pos(_,a)
(ord(t[i])<=175)
or p<>0
(ord(t[i])>=224) and
(ord(t[i])<=239)
a:=copy(a,p+1,L-p)
1 P<>0 p:=pos(_,a)



p:= 1 1
p:=0 b:=t[i]
h:=i

.9. - 17
. 8. - 15 var a:string; t:char; p,k,L:byte;
16: begin
writeln( );
. readln(a); a:= a+_;
var r,a:strihg[9]; s:char; i:byte; k:=0;
begin p:= pos(_,a); { }
r:=; writeln ( ); while p<>0 do
readln(s); begin
a:=; L:=length(a); { }
for i:= 1 to 9 do t:= copy(a,1,1); {t - }
if s=a[i] then begin r:=; if t =a then k:= k+1;
break end; {break- } a:=copy(a,p+1,L-p); { }
writeln(r); readln; p:= pos(_,a);
end. end;
63 64
writeln(k); 4. ,
readln; ( ).
end.
5. : ,
18:
, ,
26- , ( <=9) ..
. k .
.
. 6. () .
var S:string[26]; i:byte; 7. ,
begin ( ).
s:=a; for i:= 1 to 26 do
s[i]:=chr(ord(a)+ i-1); 8. (
writeln(s= ,s); ).
end. { }
9. ,
?
.
,
, 10.
1 s:=a, .. .
.
11. ,
:
( ).
var S:string[26]; i:byte;
begin 12. (
s:= _; {s- } , ..).
for i:= 1 to 26 do
s:= s + chr(ord(a) + i-1); 13. ,
writeln(s); . ,
end. .

s[0]:= chr(26). 14. , 50 ,
, 50 .

String 15. , 255 .


,
, , . ( ).
1. .
16. ( 255 ),
2. , (
( ). ).

3. .

65 66
17. , , 33. .
n ( .
).
34. .
18. .
. .
35. .
19. ( .
, .
).
36. . ,
20. 1 , 2, 3 4- .
..
37. .
21. . .
.
22. , .
38. . ,
23. .
. , .
*.
. 39. ,
, .
24. 50 .
.
.
. 40. .
.
25. .
41. .
26. ,
, . .
. .
27. (1, 3, 5, 7,. . . , ).
SET
28. .
29. .
. - BYTE CHAR
30. , . ( )
. .
31. , 1, 3, 5, .. SET OF
. , ,
.
32. ,
:
. .

67 68
Set: [3,1,2,3,3,1]
, ,
.
Set
of ; ,
3.
;
: 3. .


:


AB
- 1 *B
:= [ ..
2 +B
, -B
3 =B Boolean
, <>B Boolean
>=B Boolean
B <=B Boolean
] ;
- i IN i
i
: A

Type elemcolor == (red, yellow, blue);
Color=set of elemcolor; mntype:= set of a..f;
Var <A*B> - , ,
m: color, v: set of(l ..5,9,15);
: set of 0..100 , .
C: set f (,,,,,,); [110]*[515]=[5..10]
begin
m:=[ ]: { }; <A+B> ,
x:=2;
V: =[x..x+4,2+4+1];c:=[,,]; . , . . -
end.
.
[1, 2]+[3, 4]=[1..4]

, . <-> - ; ,
, - , .
,
<=> - ; TRUE,
:
;
[1, 2, 3]
[1,1,2,2,3]
69 70
<<>> ;
TRUE, ; .
: ,
<<=> - TRUE,
, , .
;
.
<>=> - TRUE, ,
; .
<i IN A> - I :
TRUE, . 1. .
:
var s:set of char; c:char;
2, , begin
. s:=[ ]; readln(c);
while c<>. do
: begin
var S:set of byte; k:byte; s:=s+[c]; readln(c);
begin end;
S:=[1..6]; k:=3;
s:=s-[?]; { }
if k in S then
.end.
writeln(TRUE); { TRUE} 2. .
k:=8; if k in S then
writeln() ,
else writeln( ); { - } , :
end. var symvol:set of char; s:char;
, begin
INCLUDE - . symvol:=[..,*,0..5];
: for s:=chr(0) to chr(255) do
INCLUDE (S,I); if s in symvol then writeln(s);
S - , : end.
I - , 19, ,
.
EXCLUDE - . : .
EXCLUDE (S,l);
- , INCLUDE.
+ - ,
, INCLUDE EXCLUDE

71 72
19:

.
: , i
j>2 2 ( ), N=255

j>3 3 ( ) .. j<=N
. , MN:=[2..N];
i:=1; PR:=[1]
. MN
MN:=MN-[j];
: MN ,
j:=j+i
PR - ,
N - . i
const N=255; MN
MN:=[ ]
var MN,PR:set of 1..N;
i:byte; j:word;
i:=i+1
begin
MN:=[2..N]; i:=1; PR:=[1];
repeat PR:=PR+[i]; PR
while not (i in MN) do i:=i+1; { j:=i i:=1,N
}

PR:=PR+[i]; { PR } i in PR
j:=i

while j<=N do begin
i
MN:=MN-[j]; { i}
j:=j+i end;
until MN:=[ ]; writeln( :);

for i:=1 to N do
if i in PR then write(i:4); writeln;
end.

:
1 2 3 5 7 11 13 17 19 23 29 31 41 43 47 53 59 61 67 71 .10. - 19
73 79 83 89 97 101 103 107 109 113 127 131 136 149 151 157
163 167 173 181 191 193 197 211 223 227 229 233 239 241 251

, if.

73 74
:
,
i:=1,36
.
if (= ) or (=) or (=) or (c=i) or (c=u) loto:=[ ]
z:=random(36)+1
then writeln () else writeln (); i in loto
loto:=[z]
:
if in [a, o, e, i, u] i:=2,5

then writeln () else writeln (); i
z:=random(36)+1
, , in
.

z in loto loto:=loto+[z]
20:
bool:=false bool:= true
5 36.
var loto:set of 1..36;
z,i:1..36; bool:Boolean; bool:= true
begin
loto:=[ ]; z:=random(36)+1; loto:=[z];
for i:=2 to 5 do
.11. - 20
repeat z:=random(36)+1;
if z in loto then bool:=false
else 21:
begin , .
loto:=loto+[z]; .
bool:=true; : S , t , a ,
end; MG , p ,
until bool; L , b ,
end; R , .
for i:=1 to 36 do if i in loto then write(i:4); t ,
writeln .
end. uses crt;
var R, MG,: set of char;
t,S: string; a:string [40];
p, i , L: byte; b:char;
begin
write ( ); readln(t);

75 76
t:= t+_; p:= pos(_, t); 2
S:=;
MG:= [, , , , , , , , ]; R:=MG; 1. .
while p<>0 do begin a:=copy(t,1,p-1); L:=lenght(a);
for i:= 1 to L do begin
2. .
b:= a[i]; 3. 2.
if b in MG then R:= R-[b]; end;
delete (t,1,p); p:=pos(_,t); end; 4. :
if R<>[ ] then A:=[ a..f, x..z]
writeln ( ) B:=[ c..k, u..y]
else begin for i:= 1 to 9 do begin
b:= S[i]; if b in R then write (b:3); A*B=? A-B=? B-A=? A+B=?
end; end; end. 5. 6-
6 45.

t

R<>[]

t:= t+_
p:= pos( , t)
i:=1,9
S:=
MG:= [,,,,,, b:= S[i]
,, ]
R:=MG

b in R
1 p<>0

a:= copy (t, 1, p-1) b
L:= length (a)

i:=1,L

b:= a[i] delete (t,1,p)


p:=pos(_,t)

b in MG
1

R:= R-[b] R

.12. - 21

77 78
Set
1.
; - , - .
, ,
a) ;
b) ;
c) .
2. 1
,
a) ;
b) .
3. 1
,
a) ;
b) .
4. 1
, .
5. 1
, .
6. 1 ,

a) ;
b) .
7. ,

a) ;
b) ;
c) .
8. 1
, ,
.
9. ,
.
.
79 80
10. , .
, .
. :
11. ., ? !. a. var;
. b. (type).
, .
12. .
, . Type tdat = record
Mec(Jan, Feb, Mart, April);
Dat: 1..31;
RECORD God: 2000..2002 end;
Var d: tdat; z: record
Fam: string;
Record Pol:char; t: tdat end;
. , , , ..
.. . .
.
. .

Record:

..


Record
end

:
Type
Adr=record ind:longint;
: Gor,ul:string[25]; haus, nom:integer;

Tel:longint end;
Emple=record fam, name:string [25];
, Pol: string[3]; adres:Adr;
Dolg:string[20]; datR, Beg:tdat end;
; Var C:Emple; A:array[1..100] of Emple;

,
, , , . -
81 82
Record. writeln(X = , X.Re :5:1, X.Im :5:1, i);
, . writeln(Y = , Y.Re :5:1, Y.Im :5:1, i);
, {X+Y}
writeln (Sum = , X.Re + Y.Re :5:1, X.Im+Y.Im :5:1, i);
. {X*Y}
. writeln (Product = , X.Re*Y.Re X.Im*Y.Im :5:1, X.Re*Y.Im +
Type numrec = record a:real; B:integer end; X.Im*Y.Re :5:1,i);
Grad = record a:real; f:byte end; end.
Person = record number:numrec; :
Gr:Grad; pers:string[10] end;
X = 2.0 5.0i
Var pers:person; a:real;
Y = 2.0 5.0i
Pers Sum = 4.0 10.0i
Product = -21.0 20.0i

number pers
With

with .
A B A F Pers.pers with:

Pers.number.a Pers.Gr.a

: with record do ;

,



[ ] .

Record
, .

: .
, .
:
Type Complex = record Re, Im:real End;
Var X, Y:Complex; with
Pair:Integer; .
begin = 2 + 3i Y = 7 + 8i
X.Re :=2; X.Im:=5; { } S.. = . + Y.
Y:=X; { Y}
83 84
S.. = . + Y. Mes: 1..12; God: 1900..2002 end;
Type Complex = record Re, Im: real Pol = (wom, man);
End; Res = record fam, name: string;
Var X, Y, S:Complex; Case six: pol of
Begin with X do begin Wom: (Glas: (blue, green,brown);{ }
Writeln( ); (Smos: Boolean);{ }
Readln (Re, Im) end; Man: (Datr: tdat) { }
Y.Re := 7; end;
Y.Im := 8;
With S do begin
.
Re :=X.Re + Y.Re;
Im :=X.Im + Y.Im 22:
End;
Writeln ( );
With S do , .
Writeln (Re, +i , Im); : cor- ;
End. kol- .
with .
with!



,
...

.
() . foot
: () bicycle car motor Grus

:
cor kol or kol or kol

case :
of
Type vid = (foot,bicycle,car,motor,grus);
rec = record
fam, ul:string[20];
case vidtr:vid of
: (
) foot, bicycle:(); { }
car, motor, Grus:(cor, kol: byte) end;
, var M:array[1..1000] of rec;
; S, SG:integer; i:integer; p:byte;
begin
S:=0;
Type tdat = record day : 1..31
SG:=0;
85 86
for i:=1 to 1000 do 3
with M[i] do begin
writeln ( ); 1. .
readln (fam);
writeln(); readln(ul ); 2. ,
writeln ( 1- , 2- , 3- ( military
, 4- , 5- ); TRUE).
readln (P);
case P of 3. ?
1: vidtr:= foot;
4. :
2: vidtr:= bicycle;
3: vidtr:= car; a.
4: vidtr:= motor; b. .
5: vidtr:= Grus
else writeln( ); exit
end;{ case}
case vidtr of
foot, bicycle:() ; { }
motor: begin
repeat
writeln (1- , 2- );
readln (P);
until (P=1) or (P=2)
if P=1 then kol:=3
else kol:=2;
writeln ( );
readln(cor);
end;
Car, Grus: begin
writeln( );
readln (cor,kol);
end;
end; { case}
end; { with}
for i:=1 to 1000 do
case M[i].vidtr of
Car, Motor, Grus: begin
S:=S +M[i].kol;
SG:= SG + M[i].cor end;
bicikle: S:=S+1;
end; { case}
writeln ( ,SG, );
writeln ( ,S, ); end.

87 88
Record
1. , .
: ; ;
; : , ., .; :
., ., .; (
).
) ;
) -.
2. : , ,
.
(30 ). ,
, 10 .
3. , ,
. .
.
4.
: , , , .
15 . ,
.
5. ,
: , ,
, ,
( ).
, .
20 .
6. (, , ).
( ) .
7. ,
: , , , .
) , ;
) ;
) , , - .
) ,
;
) "";
89 90
) . . ,
8. , .
: , , . 15. ,
, , : , , .
170 . :
) ; ) ;
) ; ) , .
) (); 16. : ,
) (). , , , . ,
9. . , .
: , 17.
(, ), , . : , , . .
) , ; ) ;
) , , ) .
.
10. ,
: , , .
) ;
) , 4- ,
.
11. : (),
(), .
. .
12. : ,
, , . ,
.
13.
: , , ,
, .
) ;
) ;
) .
14.
: , , , -

91 92
, - 1985 ., 30 .
1. .. .
12. ..
.: , .. .-. ., 1998 . 224 .
, - 1987 ., 32 .
2. .., ..
. Pascal. 13. . ., . .
. Turbo Pascal ( 5.5) ., .
.; . ., 1991 . 160 .
- , 1992 . 576 .
3. ., .
Turbo Pascal 14. .., .., ..
.: , 1991 . 160 .
.: , .. .-. ., 1988 ., 366 .
4. ..
Tupbo Pascal ( 6.0 7.0)
. 2-, . . 15. . .
.: - , 1997 . 320 . Turbo Pascal 7.0 . .
, 1999 . 616 .
5. ..
Turbo Pascal( 6.0) 16. .
.: , 1992 . 360 . Turbo Pascal ( 4.0 5.0)
.: , 1991 . 384 .
6. ..
Turbo Pascal( 6.0 7.0) 17. ., .
.: , , 1993 . 384 . Pascal . .
.: , 1989 . 299 .
7. , .
. . . .:
, 1998 ., 255 .

8. ..
Turbo Pascal
.: , 2000 . 496 .

9. .. Tubo Pascal 7.0 Delphi


-, 1997 . 230 .

10. ..
Pascal
.: , 1998 . 126 .

11. ..

93 94
. 665835,
. , 60

95 96
97