且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++ Tic Tac Toe游戏

更新时间:2023-02-02 21:57:35

我假设这是一个作业或作业问题?

I'm assuming this is an assignment or homework problem?

请注意,它要求您填写一些空方法的实现。所以你需要工作你写在第一个列表的框架中的代码。还要注意,该列表中的TicTacToe类定义了具有char数组的板。

Notice that it's asking you to fill in the implementation of some empty methods. So you need to work the code you've written into the framework of the first listing. Note also that the TicTacToe class in that listing defines the board with a array of char.

因此,例如:

void TicTacToe::displayBoard(){
    std::cout << board[1] << "|" << board[2]<< "|" << board[3]<< std::endl;
    std::cout << "-+-+-"<< std::endl;
    std::cout << board[4] << "|" << board[5]<< "|" << board[6]<< std::endl;
    std::cout << "-+-+-"<< std::endl;
    std::cout << board[7] << "|" << board[8]<< "|" << board[9]<< std::endl;
}