2.3.11

Operasi String

uses crt ;
var d : char ;
g,a,n,e,s : integer ;
h : real ;
b,i,m,o : string ;
label u ;
begin u : clrscr ;
writeln ('masukkan pilihan : ');
writeln ('1. length ');
writeln ('2. concat ');
writeln ('3. insert ');
writeln ('4. exit ');
writeln ('masukkan pilihan : ');
readln (d) ;

case d of
'1' : begin
clrscr;
writeln (‘masukkan string :  ‘);
readln (g);
if g = 1 then
begin
writeln (‘string 1 : ‘,length(b));
end;
else
if g = 2 then
begin
writeln (‘String 2: ‘,length(i));
end ;
readln ;
clrscr ;
goto u ;
end;

‘2’ :  begin
clrscr;
t : writeln (‘Untuk S1 ke S2 (y/n) : ‘);
readln (d);
if d = ‘i’ then
begin
writeln (‘gabung : ‘,concat (b,i));
readln ;
goto u ;
end ;
else if d = ‘n’ then
begin
writeln (‘gabung s1 dan s2 (i/t): ‘);
readln (d);
if d = ‘i’ then
begin
writeln (‘Hasil  concat : ‘,concat(I,b));
readln ;
goto u ;
end ;
end ;

3: begin
clrscr;
writeln (‘insert pada string ke  : ’ );
readln (a);
writeln (‘Masukan nomor string :  ‘ );
readln (n);
writeln (‘insert pada posisi ke : ‘);
readln (e);
if e = 1 then
begin
write (‘Hasil   :  ‘ );
insert (b,i,e ) ;
writeln (i);
readln ;
goto u ;
end
else if a = 2 then
begin
write (‘Hasil : ‘ );
insert (i,b,e);
writeln(b);
readln ;
clrscr ;
goto u ;
end ;
end ;

‘4’ : begin
end ;
end ;
end.

0 comments:

Post a Comment

 

(c)2009 -s e n j a ~. Based in Wordpress by wpthemesfree Created by Templates for Blogger