I've been spending hours trying to figure this out, but haven't found any solution to my problem yet, so I thought it might be worth asking here.
I have an assignment where I am to print out numbers 32 - 255 and their corresponding ASCII characters.
I have done that, but I am suppose to print it out in columns and I'm only able to print it out in rows.
The layout is suppose to look something like this:
32 64 @ 96 `
33 ! 65 A 97 a
34 " 66 B 98 b
35 # 67 C 99 c
36 $ 68 D 100 d
37 % 69 E 101 e
38 & 70 F 102 f
39 ' 71 G 103 g
40 ( 72 H 104 h
41 ) 73 I 105 i
42 * 74 J 106 j
Any help would be much appreciated!
My code is below.
1 2 3 4 5
int main()
{
for (int a = 32; a < 256; a++)
cout << a << " - " << char(a) << " ";
return 0;
Thank you for the answer, but I need it to print out in the same order as the layout in the original post. What I mean is the numbers have to count up vertically (as in a column) and not horizontally (rows).