This presentation is the property of its rightful owner.
Sponsored Links
1 / 16

Символьные переменные и строки PowerPoint PPT Presentation


  • 237 Views
  • Uploaded on
  • Presentation posted in: General

Символьные переменные и строки. Решение задач. Вербицкая Ольга Владимировна, Заозерная школа №16. CHAR. CHAR - символьный тип данных является порядковым, значения могут сравниваться между собой. Коды символов упорядочены, например: ‘ A ’<’ B ’<’ C ’<…<’ Z ’ ‘0’<’1’<’2’<…<’9’

Download Presentation

Символьные переменные и строки

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


3922888

, 16


3922888

CHAR

CHAR - , . , :

A<B<C<<Z 0<1<2<<9

:

PRED() , PRED(B)=A

SUCC() , SUCC(A)= B

ORD() , ORD(7)-ORD(0)=7

CHR() .

CHR() ORD() . CHR(ORD(a))=a ORD(CHR(7))=7

UPCASE()

,

For I:=Z downto A Do For I:= A toZ Do


String

STRING

- ( 1 255).

(>,<,>=,<=),

viv<viva ( )

Balkon<balkon ) (Ord(B)<Ord(b))

, +1 , :

STRING[K]=ARRAY[0..K] of CHAR;

, :

Str1[i] i- Str1.

, , .


3922888

COPY(s,p,n) stringS: string;P,n:integer

s, p, n

LENGTH(s) integerS: string;

s, ..

POS(w,s) integerS,w: string;

s w( ). , 0

CONCAT(s1,s2,Sm) stringS1,s2,Sm: string;

s1+s2++sm . 255 ,


3922888

DELETE(s,p,n)S: string;P,n:integer

n s, p

INSERT(w,s,p,)S,w: string;P:integer

s, p, w

STR(v,s)

v s

VAL(s,v,w)

s , v, w 0. ( ) , w0


3922888

2

1

ABBCCCZZZ.

ZYYAAA


3922888

ABCZ

BCZ

CZ

...

Z

3


3922888

. .

4

. , , . .

, ?

5

. .


3922888

. .

5


3922888

8

. . , .

  • 3 .

  • , . , . F, (F:=TRUE) (F:=FALSE).

  • , .. .

  • . , F . , , .. . .


3922888

8

. . , .

1


3922888

8

. . , .

2


3922888

, 200 , ( ). . , ( , , 20 ). , ( , Z), . , . , . , :

Zb Ra Ca,Dab Ra.

:

Ce Ud Fd,Gde Ud.


3922888

program str1;

Vars:string; c,cnew:char;f: boolean;i,k,max:integer;

begin

s:=''; max:=0;k:=0; f:=false;

repeat

read(c); s:=s+c;

if f then { }

if c in ['a'..'z','A'..'Z'] then k:=k+1

else begin if k>max then max:=k; f:=false end

else {f=false}

if c in ['a'..'z','A'..'Z'] then begin f:=true; k:=1 end

until c='.';

writeln(s,max);

for i:=1 to length(s) do

begin

cnew:=chr(ord(s[i])+max);

case s[i] of

'a'..'z':if cnew>'z' then write(chr(ord(cnew)-26))

else write(cnew);

'A'..'Z':if cnew>'Z' then write(chr(ord(cnew)-26))

else write(cnew);

else write(s[i])

end; end; readln; readln;

end.

, . .

, :

Zb Ra Ca,Dab Ra.

:

Ce Ud Fd,Gde Ud.


3922888

. . ( , .,a..z,A..Z . , , , , . . . , no.

, :

absCDKLMNOPvwXYabcprst.

EFGHIJQUZ


3922888

program str2;

Uses CRT;

var

a:array['A'..'Z'] of boolean;

c:char;i,k:integer;

begin

clrscr;

for c:='A' to 'Z' do

a[c]:=false;

read(c);

c:=upcase(c);

while c<>'.' do

begin

a[c]:=true;

read(c);

c:=upcase(c);

end;

k:=0;

for c:='A' to 'Z' do

if not a[c] then begin k:=k+1; write(c) end;

if k=0 then write('no');

readln; readln;

end.

, , 26 , . . , , no

:

absCDKLMNOPvwXYabcprst.

EFGHIJQUZ


  • Login