mardi 30 octobre 2018

Tic tac toe 2d array filling charachter

Im trying to create 4x4 board using tic tac toe and this is the function im using //This function resets the board to default which has to be like this default

void resetBoard(char board[4][4])                                   
{
    for (int i = 0; i < 4; i++)                                     
    {
        int boardcounter = 1;
        for (int j = 0; j < 4; j++)
        {
            board[i][j] = '0' + boardcounter;
            boardcounter++;
        }
    }
}

For this i get answer current output and if write it like this

 for (int j = 0; j < 3; j++)
    {
        board[i][j] = (char) boardcounter;
        boardcounter++;
    }

the board gets very screwed up how can i change that so that the person can enter character A,...,G WHICH represents 10-16 in the board.

Aucun commentaire:

Enregistrer un commentaire