Thứ Ba, 3 tháng 5, 2022

HOTEN1 PASCAL

var s:string;
   i:longint;

function viet_hoa(c:char):char;
var    c1:char;
    x:longint;
begin
    if('a'<=c) and (c<='z') then
    begin
        x:=ord(c);
        x:=x-32;
        c1:=chr(x);
        exit(c1);
    end
    else
        exit(c);
end;

procedure cau1;
begin
    for i:=1 to length(s) do
           write(viet_hoa(s[i]));
end;

procedure cau2;
begin
    write(viet_hoa(s[1]));
    for i:=2 to length(s) do
        if s[i-1]=' ' then
            write(viet_hoa(s[i]))
        else
            write(s[i]);
end;


begin
    assign(input,'hoten1.inp');reset(input);
    assign(output,'hoten1.out');rewrite(output);
    readln(s);
    cau1;
    writeln;
    cau2;
end.

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.