.


:




:

































 

 

 

 


. [1;n]. n .

10

.

: , .

Copy (st,p,n) st n , p.

Delete (st,p,n) st n , p.

Insert(st1,st2,p) st1 st2, p.

Length (st) st.

Pos (st1,st2) st1 st2.

Str(n,st) . n st.

Val(st,n,m) st n, m .

UpCase (Ch) . .

Concat (Strl,Str2,...,StrN) Strl, Str2,..,StrN , . ​ 255.

 

d:=copy(a,x,y) , y (integer) a (string), x (integer). : d:=copy(a,x,y). d, :

a:='';

d:=copy(a,5,3);

writeln(d);

-

delete(a,x,y) , y (integer) a (string), x (integer). : delete(a,x,y). , :

a:='';

delete(a,1,5);

writeln();

-

insert(a,b,x) , a (string) b (string), x (integer). : insert(a,b,x). b, :

b:='';

a:=''

insert(a,b,3);

writeln(b);

-

x:=pos(a,b) , , (string), b (string). : x:=pos(a,b). x, :

b:='';

a:=''

x:=pos(a,b);

writeln(b);

3

x:=length(a) , (string). :

a:='';

x:=length(a);

writeln(x);

5.

x:=ord(a) , (char). :

a:='';

x:=ord(a);

writeln(x);

137

a:=chr(x) , (char) . :

:=137;

a:=chr(x);

writeln();

- .

 

Str
'' ' ' Delete(Str, 4, 2); Delete(Str, 1, 5); '' ''

 

St
'ABCDEFG' 'ABCDEFG' Copy(St, 2, 3) Copy(St, 4, 10) 'BCD' 'DEFG'

 

St
'123456789' 'System 370' Length(St) Length(St)  

 

Str1
'abcdef ' 'abcdef' Pos('de',Strl) Pos('r',Strl)  

 

Ch
'd' UpCase(Ch) 'D'

 

Concat('AA','XX','Y') nt('','394063') 'AAXXY' ' 394063'

 

1) [A, F]+[B, D] = [A, F, B, D];

2) [1..3, 5, 7, 11] + [3..8, 10, 12, 15..20] = [1..8, 10..12, 15..20]

S1:=[1..5, 9], a S2:=[3..7, 12]. S:=S1 + S2, S=[1..7, 9, 12].

1:=[a..z]; A1:=A1 = [A]. A1=[A, a..z].

 

1) [A, F]*[B, D] = [ ], ;

2) [1..3, 5, 7, 11]*[3..8, 10, 12, 15..20] = [3, 5, 7];

3) S1:=[1..5, 9] S2:=[3..7, 12], a S:=S1 * S2, S=[3..5].

 

1) [A, F] - [B, D] = [A, F ], ;

2) [1..3, 5, 7, 11] - [3..8, 10, 12, 15..20] = [1, 2, 11];

3) S1:=[1..5, 9] S2:=[3..7, 12], a S:=S1 - S2, S=[1, 2, 9];

4) A1:=[A..Z]; A1:=A1 - [A]. 1=[B..Z].

 

in. true, , false .

.

1) 5 in [3..7] true, 5 [3;7];

2) a in [A..Z] false, .

 

:

1. , . . , , .

, . .

program palindrom;

uses crt;

var q:integer;

a,b,c:string;

begin

clrscr;

writeln(' - ');

readln(a);

for q:=1 to length(a) div 2 do { }

begin

b:=copy(a,q,1); { }

c:=copy(a,length(a)+1-q,1); { }

if b<>c then

write(' !!!');

end;

write('.');

end.

.

 

2. , , . :

program palindrom2;

uses crt;

var q:integer;

a:string;

begin

clrscr;

write(' ');

readln(a);

{========== ===========}

for q:=1 to length(a) do

if copy(a,q,1)=' ' then delete(a,q,1);

{============================================}

for q:=1 to length(a) div 2 do

begin

if copy(a,q,1)<>copy(a,length(a)+1-q,1) then

write(' , : " "');

end;

write('.');

end.

.

 

3. 1 30:

- , 2;

- , 3.

 

Program Example_1;

Const n=30;

Type mn=set Of 1..n;

Var n2, n3:mn;

{n2 , 2, n3 3}

k:Integer;

Procedure Print(m:mn);

Var i:Integer;

Begin

For i:=1 To n Do

If i In m Then Write(i:3);

Writeln;

End;

Begin

n2:=[ ]; n3:=[ ];

{ }

For k:=1 To n Do { n2 n3}

Begin

{ 2, n2}

If k Mod 2=0 Then n2:=n2+[k];

{ 3, n3}

If k Mod 3=0 Then n3:=n3+[k];

End;

{ }

Writeln (' , 2');

Print(n2);

Writeln (' , 3');

Print(n3);

Readln;

End.

 

:

- , 6;

- , 2 3.

 

quot; ". [1;n]. n .

, , . " ", : , . , 2, 3, 4 , [n/2] ( ). "" .

 

Program Example_3;

Var m:Set Of Byte;

i, k, n: Integer;

Begin

Writeln(' ( 255)');

Readln(n);

m:=[2..n];{ }

For k:=2 To n Div 2 Do

{ }

For i:=2 To n Do

{ k }

If (i Mod k=0) And (i<>k) Then m:=m-[i];

{ }

For i:=1 To n Do If i In m then Write (i:3);

Readln;

End.

 

4. , 4, 7, 9 794 .

5. "" : , , , , , .

6. m..n k, (k, ).

7. , . , .

***. 1, 2, 3, . . 10. Y=(1+2)-(3*2). Y . , 5.

 



<== | ==>
|
:


: 2016-12-18; !; : 645 |


:

:

, .
==> ...

1786 - | 1614 -


© 2015-2024 lektsii.org - -

: 0.034 .