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.
uses crt;
var st1:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st1);
d:=length(st1);
for i:=1 to d do
if (st1[i]='a') and (st1[i+1]='b') and (st1[i+2]='c') then delete(st1,i,3);
writeln(st1);
readln;
end.
tk
uses crt;
var st1:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st1);
d:=length(st1);
for i:=1 to d do
if (st1[i]='a') and (st1[i+1]='b') and (st1[i+2]='c') then delete(st1,i,3);
writeln(st1);
readln;
end.
uses crt;
const fi='dulieu.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if (st[i] in ['A'..Z']) or (st[i] in ['0'..'9']) or (st[i]=#32) then write(f1,st[i]);
close(f1);
end.
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
uses crt;
const fi='dulieu.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if (st[i] in ['A'..Z']) or (st[i] in ['0'..'9']) or (st[i]=#32) then write(f1,st[i]);
close(f1);
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
for i:=1 to d do
if st[i] in ['a'..'z'] then upcase(st[i]);
writeln(st);
readln;
end.
const fi='vao.inp';
fo='ra.out';
var f1,f2:text;
st:string;
i,d:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
for i:=1 to d do
if st[i]='a' then delete(st,i,1);
writeln(f2,st);
close(f1);
close(f2);
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
if (st[i]='a') or (st[i]='A') then st[i]:='b';
writeln(st);
readln;
end.
Câu 1:
const fi='xau.inp';
fo='xau.out';
var s:string;
d,i:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,s);
d:=length(s);
for i:=1 to d do
if s[i]<>'A' then write(f2,s[i]);
close(f1);
close(f2);
end.
Câu 2:
const fi='xau.inp';
fo='xau.out';
var s:string;
d,i,dem:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i]=' ' then inc(dem);
writeln(f2,dem+1);
close(f1);
close(f2);
end.