dimanche 21 avril 2019

Array that prints gibberish in another compiler | C++

I use Visual Studio software And everything works fine.

When I use the other compliere after the output of the array goes out in gibberish.

My code:

print_b?ard[9][9] = {};
print_b?ard[0][0] = '\0';

Then I enter data into the array and they print like this:

?????·?²?
?|?-`???
???-?????
??|Z%??
?????????
·1²??? 
?????????
?????] @?
?????????

This is the code that prints:

void Game::PrintWin(char print_board[][9]) {
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            cout << print_board[i][j];
        }
        cout << endl;
    }
}

This is the only error I get but I do not know if it's related to my problem:

Game.cpp:5:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
  print_board[9][9] = {};

Does anyone have an idea why this is so?

Aucun commentaire:

Enregistrer un commentaire