Hi guys,
Firstly, huge thankyou to you all who helped or had suggestions. Gained a lot of info from it, some stuff I didn't understand but that was great as it meant I had to dig a little deeper
I've amended the code a bit, seemed easier to have columnwidths etc and to use the (((i+1) mod =0) then writeln as a way to get the characters to display ok.
As mentioned, the first 32 characters throw the table out of sync, instead of these I was going to use the 2/3 char's for them.
This is where I tried to get clever....
On the script you can see I've tried to use an array and I can see this is faulty - Am trying to work around this and see how it implements into the script and so on...is completely new ground to me.
But, the issue i'm having is now it won't compile (even without the array inc.) where it was before.
I get an unexpected end error?
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 ');
var 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 ');
index :integer;
i: integer;
ch: Char;
begin {main program}
ClrScr;
writeln (Title);
writeln;
{ for i := 0 to 32 do
begin
read(unprint[i]);
write (chr(i):columnwidth);
{ write ('',unprint[0..32]); }
{ if (((index+1) mod columncount) = 0 then }
{ writeln;
end; }
for i:= 33 to 127 do
begin
write (chr(i):columnwidth);
write (' ',i:4);
if (((i+1) mod Columncount) = 0) then
writeln;
end;
{ writeln (' '); }
writeln;
writeln;
writeln ('Press any key to continue' ,ch);
read (ch);
end.
Please ignore the improper way in which I've typed the program, still picking it up as I go.
Thanks again for all your help and apologies for not being able to reply to the thread, I think I'm waiting on the account to be verified?
Bookmarks