# Складання і реалізація програм обробки рядкових величин 

• Published on
11-Jan-2016

• View
49

0

DESCRIPTION

. . : , , . Program Task1; Const A= ; B=; C=; Var L1, L2, L3: integer; Begin L1:=Length(A); L2:=Length(B); - PowerPoint PPT Presentation

Transcript

• 1 : , ,

Program Task1;ConstA=;B=;C=;VarL1, L2, L3: integer;BeginL1:=Length(A);L2:=Length(B);L3:=Length(C);WriteLn(L1, L2, L3);End.

• 2 . : , , .Program Task2;ConstA=;VarA1, A2, A3:string;BeginA1:=copy(A, 1, 4);A2:=copy(A, 5, 4);A3:=copy(A, 3, 3)+ copy(A, 1, 1);WriteLn(A1, A2, A3);End.

• 3 .Program Task3;ConstA=;Vark, L, i: integer;Begink:=0;L:=Length(A);For i:=1 to L dobeginif copy(A, i,1)=A then k:=k+1;end;Writeln(k);End.

• 4 , Turbo Pascal .Program Task4;Var R, R1, R2, R3: string;N: integer;BeginWriteln( ); Readln(R);Writeln( ); Readln(R1);Writeln( ); Readln(R2);While Pos(R1, R)>0 do BeginN:=pos(R1, R);Delete(R, N, Length(R1));Insert(R2, R, N);end; Writeln(R);End.

• 5 . , .Program Task5; Uses Crt; Var A:string; k, i, L:integer;BeginClrScr;Write('i ');ReadLn(A);L:=Length(A);K:=1;For i:=1 to L do begin if copy(a,i,1)=' then k:=k+1; end;WriteLn(' i ci ',K);End.

• 6 . .Program Task6; Uses Crt; Var A1, A2:string; i,L:integer;BeginClrScr;Write('i ');ReadLn(A1);L:=Length(A1);A2:='';For i:=L downto 1 do begin A2:=A2+copy(A1,i,1); end;WriteLn(A1);WriteLn(A2);ReadLn;End.

• 7 .Program Task7; Uses Crt; Var A1, A2:string; i,L:integer;BeginClrScr;Write('i ');ReadLn(A1);L:=Length(A1);A2:='';For i:=L downto 1 do begin A2:=A2+copy(A1,i,1); end;IF A2=A1 then WriteLn('') else WriteLn('i');End.

• 8 - ..Program Task8; Uses Crt; Const a1=''; a2='..'; Var A:string; i,L:integer;BeginClrScr;Write( ');ReadLn(A);L:=Length(A);For i:=1 to L-5 do begin if copy(A,i,5)=A1 then begin delete(A,i,5); insert(a2,a,i) end; end;WriteLn(A);ReadLn;End.

• 9 . , .PROGRAM Task9;Uses Crt; Const A='IOI'; Var a2,s:string; i, L:integer;BeginClrScr;s:='';L:=Length(A);for i:=1 to L dobegina2:=copy(a,i,1);if a2'' then s:=s+a2;end;WriteLn(s);End.