How do I get this code to print vertically instead of horizontally? I want the characters to be displayed in this manner...
a
b
c
...Instead of abc
#include <stdio.h>
main()
{
int c;
for (c=0;c<256;c++)
printf("%c",c);
}
How do I get this code to print vertically instead of horizontally? I want the characters to be displayed in this manner...
a
b
c
...Instead of abc
#include <stdio.h>
main()
{
int c;
for (c=0;c<256;c++)
printf("%c",c);
}
Last edited by volk; 02-01-2003 at 06:06 PM.
Originally posted by volk
How do I get this code to print vertically instead of horizontally? I want it the the characters to be displayed in this manner...
a
b
c
...Instead of abc
printf("%c",c);
}What you get depends on what compiler you use.... console versus win gui, and there are several chars that are not printable.Code:unsigned ansi; for(ansi=0; ansi < 256; ansi++) printf("%c\n", ansi);
>>there are several chars that are not printable.
... so you use the isprint() function (ctype.h) to test each value as you go through the loop, and only printf() it if it is actually printable.
Either that or use %x to print the hex value instead of the ASCII value.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]