.


:




:

































 

 

 

 


N 5.




 

, . PASCAL STRING. . String ASCII 255 .

string

 

Var B: String [30]; { , 30 } st: String; { 255 }

 

.

, , :

- i- ;

- , ;

- , ;

- , ;

- ;

- , ;

- ;

- .

.

 

Function Concat (s1 [, s2,..., sn]: string): String

 

.

: WriteLn (Concat('ABC','DEF')); { 'ABCDEF' }

 

Function Copy(s: String; index: Integer; count: Integer): String;

 

.

:

Var s: String;

Begin

s:= 'ABCDEF';

WriteLn(Copy(s, 2, 3)) { 'BCD' }

End.

 

Function Length (s: String): Integer;

 

.

s:='Welcome to Pascal';

WriteLn (' = ', length(s)); {17}

 

function Chr(x: Byte): Char;

 

ASCII.

 

Function Pos(substr: String; s: String): Byte;

 

.

Var s: String;

Begin

s:= ' 123.5';

{ }

While Pos(' ', s) > 0 do

s[Pos(' ', s)]:= '0';

End.

 

Procedure Delete(Var s: String; index: Integer; count: Integer);

 

.

Var s: String;

Begin

s:= 'Honest Abe Lincoln';

Delete(s,8,4);

WriteLn(s); { 'Honest Lincoln' }

End.

 

Procedure Insert(source: String; Var s: String; index: Integer);

 

.

Var s: String;

Begin

s:= 'Honest Lincoln';

Insert('Abe ', s, 8);

WriteLn(s); { 'Honest Abe Lincoln' }

End.

 

Procedure Str(x [:width [:decimals ]];Var s: String);

 

- , Write.

 

:

Function IntToStr(i: Longint): String;

{ }

Var s: String[11];

Begin

Str(i, s);

IntToStr:= s;

End;

Begin

WriteLn(IntToStr(-5322));

End.

 

Procedure Val(s:String; Var v; Var code: Integer);

 

, Read. S - ASCII , v - real Integer, , code - Integer.

:

Var str: String;

i, code: Integer;

Begin

str:='123.456';

Val(str, i, code);

{ ? }

If code <> 0 Then WriteLn(' : ', code)

Else WriteLn(' = ', i);

End.

 

.

:

, ( ) , .

 

1. .

 

2. , .

 

3. .

 

4. . . , , .

 

5. child children.

 

6. . , .

 

7. , .

 

8. , , .

9. . .

 

10. .

 

11. , .

11.

12. .

 

13. . , .

 

14. . .

 

15. . .

 

16. , .

 

17. , . , .

 

18. , , .

 

19. ( ) .

 

20. .

 

21. . , .





:


: 2015-10-27; !; : 483 |


:

:

- , - .
==> ...

782 - | 759 -


© 2015-2024 lektsii.org - -

: 0.019 .