compare, de7

04/02/2023

doan gia khanh sent

Code
program compare;
uses crt;
const fi='compare.inp';fo='compare.out';
var a,b : string;
    res : string;
    i : integer;
    f : text;

procedure nhap;
begin
    assign(f, fi); reset(f);
    readln(f,a);
    readln(f,b);
    close(f);
end;

BEGIN
    clrscr;
    nhap;
    res := 'a=b';

    if (length(a) > length(b)) then res := 'a>b';
    if (length(a) < length(b)) then res := 'a<b'
    else
     begin
         for i := 1 to length(a) do
           begin
               if (a[i] > b[i]) then
                 begin
                     res := 'a>b';
                     break;
                 end;
               if (a[i] < b[i]) then
                 begin
                     res := 'a<b';
                     break;
                 end;
           end;
     end;
    assign(f, fo); rewrite(f);
    write(res);
    write(f,res);
    close(f);
END.