Dengan menggunakan compiler Turbo Pascal For Windows v1.5, SourceCode-nya adalah sebagai berikut:
1.Konversi karakter ASCII Decimal :
program konversi_ASCII;
uses wincrt;
var
i,j: char;
k: integer;
label akhir;
begin
repeat;
clrscr;
writeln('*PROGRAM ASCII(Dec)*');
writeln('*==================*');
writeln('* 1. ascii to char *');
writeln('* 2. char to ascii *');
writeln('* 3. keluar / exit *');
write('* masukan pilihan: ');
j := readkey ;
j := upcase(j);
if j = '3' then
goto akhir
else
writeln;
write('input : ');
if j = '1' then
begin
readln(k);
writeln('ascii to char = ', chr(k));
end
else if j = '2' then
begin
readln(i);
writeln('char to ascii = ', ord(i))
end;
write('>>>tekan enter untuk melanjutkan');
readkey;
until j = '3';
akhir:
end.
2. Menampilkan Tabel ASCII :
program Tabel_ASCII;
uses wincrt;
var i,baris:byte;
begin
clrscr;
for i:= 32 to 255 do
begin
baris:=baris+1; if(baris>25) then baris:=1;
GotoXY(((i-32) div 25)*8+1,baris);
write(i:4,'=',chr(i):3);
end;
readln;
end.
3.Menampilkan Tabel ASCII perhuruf :
program ASSCII_viewer;
uses wincrt;
var i,n:integer;
begin
clrscr;
for i := 1 to 255 do
begin
if i < 255 then write(i,' : ',char(i), ', ') else write(i,' : ',char(i)); readkey;
end;
end.
1.Konversi karakter ASCII Decimal :
program konversi_ASCII;
uses wincrt;
var
i,j: char;
k: integer;
label akhir;
begin
repeat;
clrscr;
writeln('*PROGRAM ASCII(Dec)*');
writeln('*==================*');
writeln('* 1. ascii to char *');
writeln('* 2. char to ascii *');
writeln('* 3. keluar / exit *');
write('* masukan pilihan: ');
j := readkey ;
j := upcase(j);
if j = '3' then
goto akhir
else
writeln;
write('input : ');
if j = '1' then
begin
readln(k);
writeln('ascii to char = ', chr(k));
end
else if j = '2' then
begin
readln(i);
writeln('char to ascii = ', ord(i))
end;
write('>>>tekan enter untuk melanjutkan');
readkey;
until j = '3';
akhir:
end.
2. Menampilkan Tabel ASCII :
program Tabel_ASCII;
uses wincrt;
var i,baris:byte;
begin
clrscr;
for i:= 32 to 255 do
begin
baris:=baris+1; if(baris>25) then baris:=1;
GotoXY(((i-32) div 25)*8+1,baris);
write(i:4,'=',chr(i):3);
end;
readln;
end.
3.Menampilkan Tabel ASCII perhuruf :
program ASSCII_viewer;
uses wincrt;
var i,n:integer;
begin
clrscr;
for i := 1 to 255 do
begin
if i < 255 then write(i,' : ',char(i), ', ') else write(i,' : ',char(i)); readkey;
end;
end.
Post a Comment