Well, let's see.. first thing is this:
Code:
Title:string = (' ASCII TABLE ');
String constants only need to be delimited with apostrophes ('). You don't need the parentheses.
Next..
Code:
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 ');
Since you are creating a constant array, this needs to be "const unprint" instead of "var unprint". Note that, if you change this, the var declarations below (index, i, and ch) will need their own "var" preceding them.
Next..
What you are telling the computer to do is to read input from the user and put it into your unprintables array. I don't think that is what you are intending, you just want to use the array, so I would recommend deleting that line entirely, as it is unnecessary.
You will also need to put in a write for your character index value for the unprintables. (like "write(' ',i:4);" in the printables section)
Next..
Code:
if (((index+1) mod columncount) = 0 then
You declared another index variable which you only used in this line, but I think you just need the one "i" index variable and to use it here. Also, you have unbalanced parentheses in your conditional expression (too many lefts/opens, not enough rights/closes).
Next..
Code:
writeln ('Press any key to continue' ,ch);
The ",ch" part is unnecessary, especially because at this point, ch is undefined. You don't need to write out the contents of the variable you are going to use as a "dummy" (ie, you're not really going to use the value it returns) in the read statement afterwards.
Next..
Block comments are not nest-able, unless you use a different set. Block comments in Pascal start with "{" or "(*" and end with the FIRST matching "}" or "*)" encountered in the code. For example, if have some block comments in a block of code, then decide you want to comment out the entire block for whatever reason, use the "other" set to do it.
If you have this:
Code:
for i := 0 to 32 do { do the unprintables first }
begin
write (chr(i):columnwidth,' ',i:4);
if (((index+1) mod columncount) = 0 then
writeln;
end;
and you want to comment it out, then do it like this:
Code:
(*
for i := 0 to 32 do { do the unprintables first }
begin
write (chr(i):columnwidth,' ',i:4);
if (((index+1) mod columncount) = 0 then
writeln;
end;
*)
Lastly, just so you know, you can use the [code]{put your code here}[/code] tags around your code to preserve formatting here in the forum.
Bookmarks