* đổi kí tự
program doi_kitu;
uses crt;
var c:char;
begin
clrscr;
write('Nhap ki tu hoa: '); readln(c);
c:=chr(ord(c)+32);
write('Ki tu thuong la: ',c);
readln;
end.
*đổi chuỗi;
program doi_chuoi;
uses crt;
var s:string;
i:byte;
begin
clrscr;
write('Nhap chuoi: '); readln(s);
for i:=1 to length(s) do
if s[i] in ['A'..'Z'] then s[i]:=chr(ord(s[i])+32);
write('Chuoi sau khi doi la: ',s);
readln;
end.
*đổi kí tự thường sang hoa
program doi_kitu;
uses crt;
var c:char;
begin
clrscr;
write('Nhap ki tu thuong: '); readln(c);
c:=upcase(c);
write('Ki tu hoa la: ',c);
readln;
end.
*đổi chuỗi thường thành hoa
program doi_chuoi;
uses crt;
var s:string;
i:byte;
begin
clrscr;
write('Nhap chuoi: '); readln(s);
for i:=1 to length(s) do
if s[i] in ['a'..'z'] then s[i]:=upcase(s[i]);
write('Chuoi thuong la: ',s);
readln;
end.
*Chuẩn hóa họ tên
program chuanhoa;
uses crt;
var s:string;
i:byte;
begin
clrscr;
write('Nhap ho va ten: '); readln(S);
for i:=1 to length(s) do
if s[i] in ['A'..'Z'] then s[i]:=chr(ord(s[i])+32);
s[1]:=upcase(s[1]);
for i:=2 to length(s) do
if s[i]=' ' then s[i+1]:=upcase(s[i+1]);
write('Ho va ten la: ',s);
readln;
end.