Nhập vào một xâu kí tự bất kì
a) Xóa toàn bộ dấu trắng có trong xâu
b) Đổi toàn bộ chữ số có trong xâu sang từ tiếng anh
0 bình luận về “Nhập vào một xâu kí tự bất kì a) Xóa toàn bộ dấu trắng có trong xâu b) Đổi toàn bộ chữ số có trong xâu sang từ tiếng anh”
program LN; uses crt; var s:string; i:integer; begin clrscr; writeln(‘Nhap vao 1 chuoi bat ki: ‘); readln(s); for i:= 1 to length(s) do if s[i] = ‘ ‘ then delete(s,pos(‘ ‘,s),1); writeln(s); for i:= 1 to length(s) do begin if s[i] = ‘0’ then write(‘zero ‘); if s[i] = ‘1’ then write(‘one ‘); if s[i] = ‘2’ then write(‘two ‘); if s[i] = ‘3’ then write(‘three ‘); if s[i] = ‘4’ then write(‘four ‘); if s[i] = ‘5’ then write(‘five ‘); if s[i] = ‘6’ then write(‘six ‘); if s[i] = ‘7’ then write(‘seven ‘); if s[i] = ‘8’ then write(‘eight ‘); if s[i] = ‘9’ then write(‘nine ‘); end; readln; end.
program xaukitu; uses crt; var st : string; i,n : integer; begin clrscr; write(‘Nhap xau ki tu :’); readln(st); for i:=1 to length(st) do while st[i]=#32 do delete(st,i,1); writeln(‘Xau ki tu khong co dau trang :’,st); for i:=1 to length(st) do if st[i] in [‘0’..’9′] then begin if st[i]=’0′ then write(‘zero’); if st[i]=’1′ then write(‘one’); if st[i]=’2′ then write(‘two’); if st[i]=’3′ then write(‘three’); if st[i]=’4′ then write(‘four’); if st[i]=’5′ then write(‘five’); if st[i]=’6′ then write(‘six’); if st[i]=’7′ then write(‘seven’); if st[i]=’8′ then write(‘eight’); if st[i]=’9′ then write(‘nine’); end; readln end.
program LN;
uses crt;
var s:string;
i:integer;
begin
clrscr;
writeln(‘Nhap vao 1 chuoi bat ki: ‘);
readln(s);
for i:= 1 to length(s) do
if s[i] = ‘ ‘ then delete(s,pos(‘ ‘,s),1);
writeln(s);
for i:= 1 to length(s) do
begin
if s[i] = ‘0’ then write(‘zero ‘);
if s[i] = ‘1’ then write(‘one ‘);
if s[i] = ‘2’ then write(‘two ‘);
if s[i] = ‘3’ then write(‘three ‘);
if s[i] = ‘4’ then write(‘four ‘);
if s[i] = ‘5’ then write(‘five ‘);
if s[i] = ‘6’ then write(‘six ‘);
if s[i] = ‘7’ then write(‘seven ‘);
if s[i] = ‘8’ then write(‘eight ‘);
if s[i] = ‘9’ then write(‘nine ‘);
end;
readln;
end.
program xaukitu;
uses crt;
var st : string;
i,n : integer;
begin clrscr;
write(‘Nhap xau ki tu :’); readln(st);
for i:=1 to length(st) do while st[i]=#32 do delete(st,i,1);
writeln(‘Xau ki tu khong co dau trang :’,st);
for i:=1 to length(st) do if st[i] in [‘0’..’9′] then begin
if st[i]=’0′ then write(‘zero’);
if st[i]=’1′ then write(‘one’);
if st[i]=’2′ then write(‘two’);
if st[i]=’3′ then write(‘three’);
if st[i]=’4′ then write(‘four’);
if st[i]=’5′ then write(‘five’);
if st[i]=’6′ then write(‘six’);
if st[i]=’7′ then write(‘seven’);
if st[i]=’8′ then write(‘eight’);
if st[i]=’9′ then write(‘nine’); end;
readln
end.