Eeek Borland... I used it in a class over 12+ years ago...
The structure of your first for-loop is correct, but I am not sure that you can use 'char' as the type to do that. You need to use 'int' and start from 1, not 0. I believe that you cannot display the first 16 chars as normal display. You will hear a beep when it hits #7.
Now, you just need another variable declared outside the loop and may name it chrCount. Initiate it to 0 as well. Then inside the loop, increment it by 1 at the beginning of the loop. After that, check if the value of chrCount is equal to 16. If it is, print out a new line and reset the value to 0. There is no else statement for this if. The rest of the content in the loop is to display the number as ASCII. I cannot remember what function you need to display that. Maybe it is call chr(#)???
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239
That's because you're breaking out of the loop after 16 characters. Instead, when you hit 16
1) reset the character counter
2) output the ENDL
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
You still need to reset the chrCount to 0 inside your if-statement. Oh and display the letter after the if-statement, not before.
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
As WaltP said... You need {} to create the scope of if-statement. If you use if-statement without that, only the immediate code line right after 'if' will be executed under the 'if' condition.
Taywin
Posting Virtuoso
1,727 posts since Apr 2010
Reputation Points: 229
Solved Threads: 239