//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//\\\\//
ID: 3884940 • Letter: #
Question
//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\ // Program: Lab 02 // Author: // Date: // Course: CSCI/CMPE 2380 // Description: This program ... /* Output should look like this: 0 1 2 0 | | ----------- 1 | | ----------- 2 | | Row: 1 Col: 1 0 1 2 0 | | ----------- 1 | X | ----------- 2 | | */ //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\ #include<iostream> #include<string> using namespace std; //class representing the tic tac toe game class tictactoe { public: //should initialize whose turn it is and the moves array tictactoe() { } //should place an X or O, based on whose turn it is, at location x,y in the moves array bool PlaceMove(int x, int y) { return false; } //draws the board using the moves 2d array void DrawBoard() { } //should return true if there are 3 X's or 3 O's in a row bool GameOver() { return false; } //should return X or O char Winner() { return ' '; } private: char moves[3][3]; bool xturn; }; int main() { tictactoe board; int col, row; do { board.DrawBoard(); cout<<"Row: "; cin >> row; cout<<"Col: "; cin >> col; if(!board.PlaceMove(row,col)) cout<< "Invalid Move" <<endl; } while(!board.GameOver()); board.DrawBoard(); cout<<board.Winner()<<" wins!"<<endl; return 0; }
Explanation / Answer
// Program: Lab 02 // Author: // Date: // Course: CSCI/CMPE 2380 // Description: This program ... /* Output should look like this: 0 1 2 0 | | ----------- 1 | | ----------- 2 | | Row: 1 Col: 1 0 1 2 0 | | ----------- 1 | X | ----------- 2 | | */ //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\ #include #include using namespace std; //class representing the tic tac toe game class tictactoe { public: //should initialize whose turn it is and the moves array tictactoe() { } //should place an X or O, based on whose turn it is, at location x,y in the moves array bool PlaceMove(int x, int y) { return false; } //draws the board using the moves 2d array void DrawBoard() { } //should return true if there are 3 X's or 3 O's in a row bool GameOver() { return false; } //should return X or O char Winner() { return ' '; } private: char moves[3][3]; bool xturn; }; int main() { tictactoe board; int col, row; do { board.DrawBoard(); cout row; cout col; if(!board.PlaceMove(row,col)) coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.