Code:
program ASCIITABLE(output);
uses crt;
const columncount = 8; {8 columns as 128 is div perfectly by 8}
columnwidth = 3; {unprintables need 3 spaces, neater output}
Title:string = (' ASCII TABLE ');
By:string = (' By Steve Green ');
unprint: array [0..32] of string =(
{string as below are 'string' variable}
'NUL','SOH','STX','ETX','EOT','ENQ',
'ACK','BEL','BS ','HT ','LF ','VT ',
'FF ','CR ','SO ','SI ','DLE','DC1',
'DC2','DC3','DC4','NAK','SYN','ETB',
'CAN','EM ','SUB','ESC','FS ','GS ',
'RS ','US ','SP ');
var i: integer;
ch: Char;
idx: byte;
begin {main program}
ClrScr;
writeln (Title);
writeln;
writeln (by);
writeln;
for i := 0 to 32 do
begin
write (' ',unprint[i]:columnwidth);
write (' ',i:3);
if (((i+1) mod columncount) = 0) then
writeln;
end;
for i:= 33 to 127 do
begin
write (' ',chr(i):columnwidth);
write (' ',i:3);
if (((i+1) mod Columncount) = 0) then
writeln;
end;
{ writeln (' '); }
writeln;
writeln;
writeln ('Press Return to continue' ,ch);
read (ch);
end.
So after playing around a bit, this is what I've got.
It displays Ok, Not as perfect as I'd like it but this is within my scope.
I'd like to be able to use the characters instead...
I can do chr 1 to 7 (these display ok) and 16 - to 127 but it's 8 that causes the problem throws the whole table out.
Bookmarks