This works fine. However, I want it to be in shape of a 2D char array.. But when I put these (char(218),char(196) etc) in the char array indexes, and then outputs the char array, it gives me a completely different thing...
(Why I want it to be stored in char array?
Well, because I am developing kind of a game in which I am supposed to move tokens into the box. These tokens will move into these boxes and by my logic, If I use a char array then I can very easily replace the central char(32) (which is a space) with the token when I want to. Hence, it would be far more easier to make this program if I use char array instead of simple couts...)
Also, can anyone tell how can I shorten the size of the box? I need 3 spaces in between the box as I want the token to be in the center of box.. The perfect size would be with 2 spaces but then my token would never be central and in case of just 1 space, space between the boxes become too small. Thank you!
there is nothing magic about char.
char c = 32; //c is now a space. don't need hex, casting, or any other weirdness. if you know ascii in hex, use hex, if you know it in decimal, use decimal.
if you put a zero as the last character, it will write as a c-string with cout:
cout << char(218) << char(196) << char(196) << char(196) << char(191) << endl;
becomes
char line1[] = {218,196,196,196,191,'\n',0}; //I even put the end of line in there.
cout << line1;
which is pretty much the same as above, except you already had it in decimal so I thought you might want this.