konversi bahasa ASCII;
Uses Crt;
Uses Crt;
Var
Bil : Byte;
rhex : array [1..5] of integer;
Ch,Ch1 : Char;
x,c : integer;
hex : string;
Bil : Byte;
rhex : array [1..5] of integer;
Ch,Ch1 : Char;
x,c : integer;
hex : string;
Procedure Hexa(bhex : integer);
Begin
x := 1;
Repeat
if bhex >= 16 then
Begin
rhex[x] := bhex mod 16;
bhex := bhex div 16;
end
else rhex[x] := bhex;
inc(x);
until bhex <= 16;
end;
Begin
x := 1;
Repeat
if bhex >= 16 then
Begin
rhex[x] := bhex mod 16;
bhex := bhex div 16;
end
else rhex[x] := bhex;
inc(x);
until bhex <= 16;
end;
Begin
Repeat
Clrscr;
Writeln(‘Tekan Suatu Tombol !’);
Ch := Readkey;
Bil := Ord(Ch);
hexa(bil);
Writeln(‘Karakter : ‘,Ch);
Writeln(‘Kode ASCII : ‘,Bil);
Write (‘Kode Hexa : ‘);
For c := 1 to x-1 do
Write(Rhex[x],’ ‘);
Writeln;
Writeln(‘Mau Lagi ? Y/T ‘);
Repeat
Ch1 := Readkey;
Ch1 := Upcase(Ch1);
Until Ch1 in ['Y','T'];
Until Ch1 = ‘T’;
end.
Repeat
Clrscr;
Writeln(‘Tekan Suatu Tombol !’);
Ch := Readkey;
Bil := Ord(Ch);
hexa(bil);
Writeln(‘Karakter : ‘,Ch);
Writeln(‘Kode ASCII : ‘,Bil);
Write (‘Kode Hexa : ‘);
For c := 1 to x-1 do
Write(Rhex[x],’ ‘);
Writeln;
Writeln(‘Mau Lagi ? Y/T ‘);
Repeat
Ch1 := Readkey;
Ch1 := Upcase(Ch1);
Until Ch1 in ['Y','T'];
Until Ch1 = ‘T’;
end.
Post a Comment