I'm losing an unbelievable amount of time finding the right Hex and Dec codes to write "\x82" or char(178) for example, so the right characters can be displayed correctly in the console.
Isn't there any way to simply switch the console in UTF-8 mode?
I am programming in French and I have to use a lot of accents.
I also have another problem.
I am now programming a game of minesweeper in console mode.
The way it works is that I am using an array of structures.
Code:
struct table
{
short number ; // Mine = 9, empty square = 0, other than that, 1 to 8
char char_ ; // Char displayed in the grid of the mine sweeper
int x, //Used to display in the console
y ;
} ;
The tests done when the player performs an action on a square are done using the char_ variable.
At the beginning of the game, all char_ are initialized to the char displayed when the square is covered.
So, when someone "clicks" (I use the keyboard to play), I must change the content of char_ in order do display the square as uncovered (blank), with a number or with a mine.
The problem comes when the player clicks on a number, I have to change the value char_ for the value of number_ in order to display the right number.
So, I must do something like
tabMineSweeper[x][y].char_ = someconvertingfeature(tabMineSweeper[x][y].number) ;
So, I need a simple way to convert a short to a char.
I could use switch or ifs but it will make my code uselessly long.
Is there any way to do that?
Thanks!
---Edit---
I am not used with :: that I see everywhere in almost every code sample (std::sting for example)... so if anyone could explain without using these it would be great. Thanks <3