Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau :'); readln(s);
for i:=1 to length(s) do if s[i]<>'a' then write(s[i]);
readln
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]='a' then delete(st,i,1);
writeln(st);
readln;
end.
uses crt;
var st:string;
begin
clrscr;
write('Nhap xau st:'); readln(st);
delete(st,3,4);
writeln('Xau sau khi xoa la: ',st);
readln;
end.
Cách 1: Có sử dụng chương trình con
uses crt;
var st:string;
{------------chuong-trinh-con-------------------}
function doi(st1:string):string;
var i,d:integer;
begin
d:=length(st1);
for i:=1 to d do
st1[i]:=upcase(st1[i]);
doi:=st1;
end;
{-------------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('Nhap xau:'); readln(st);
writeln(doi(st));
readln;
end.
Cách 2: Không sử dụng chương trình con
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
st[i]:=upcase(st[i]);
writeln(st);
readln;
end.
*Cách có sử dụng chương trình con:
uses crt;
var st:string;
{--------------chuong-trinh-con---------------}
function doixau(st:string):string;
var i,d:integer;
begin
d:=length(st);
for i:=1 to d do
st[i]:=upcase(st[i]);
doixau:=st;
end;
{-------------chuong-trinh-chinh---------------}
begin
clrscr;
write('Nhap xau:'); readln(st);
writeln('Xau doi sang chu hoa la: ',doixau(st));
readln;
end.
*Cách không sử dụng chương trình con:
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
st[i]:=upcase(st[i]);
writeln('Xau sau khi doi la: ',st);
readln;
end.
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if not(st[i] in ['a'..'z']) and not(st[i] in ['A'..'Z']) then write(st[i]);
readln;
end.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
writeln('Cac ki tu so co trong xau S:');
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then
begin
write(s[i]:4);
inc(dem);
end;
writeln;
writeln('So ki tu chu so co trong xau S: ',dem);
for i:=1 to d do
if s[i] in ['0'..'9'] then s[i]:='A';
writeln('Xau sau khi doi la: ',s);
readln;
end.
Bài 1:
uses crt;
var S:String;
vt:integer;
begin
clrscr;
Write(‘Nhap 1 xau:’); Readln(S);
While pos(‘nang’,s)>0 do
Begin
Vt:= pos(‘nang’,s);
Delete(s,vt,4);
Insert(‘mua’,s ,vt);
End;
Writeln(‘Xau sau khi thay the ’,s);
Readln;
End.
Bài 2:
uses crt;
var st:string;
d,i,kt:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
kt:=0;
for i:=1 to d do
if st[i]<>st[d-i+1] then kt:=1;
if kt=0 then writeln(st,' la xau doi xung')
else writeln(st,' khong la xau doi xung');
readln;
end.
Bài 1:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
while s[1]=#32 do delete(s,1,1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
while s[length(s)]=#32 do delete(s,length(s),1);
for i:=1 to length(s) do
if s[i]=#32 then writeln(s[i]) else write(s[i]);
writeln;
readln
end.
Bài 2:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
while s[1]=#32 do delete(s,1,1);
while pos(#32,s)<>0 do delete(s,pos(#32,s),1);
while s[length(s)]=#32 do delete(s,length(s),1);
writeln('Xau sau khi xoa ki tu trong: ',s);
readln
end.
Bài 3:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
for i:=1 to length(s) do s[i]:=upcase(s[i]);
write('Xau sau khi in hoa : ',s);
readln
end.
Bài 4:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
write('Xau sau khi dao nguoc: ');
for i:=length(s) downto 1 do write(s[i]);
readln
end.
Program HOC24;
var s: string;
begin
write('Nhap xau: '); readln(s);
delete(s,1,1);
write(s);
readln
end.