I have a COMPSCI C++ HW and I cant really figuer out how to do it can someone pl
ID: 3565898 • Letter: I
Question
I have a COMPSCI C++ HW and I cant really figuer out how to do it can someone please help.
Ask the user for a number between 3 and 9 (inclusive). USING LOOPS, create a tic-tac-toe board with the dimensions the user entered. Alternate "X" and "O". Follow the examples below.
Please enter a number between 3 and 9: 13
Please follow the directions!
Please enter a number between 3 and 9: 3
X|O|X
-|-|-
O|X|O
-|-|-
X|O|X
Note that the start switches between X and O each new line that for me was the tricky part.
Explanation / Answer
#define GRID_SIZE 9 using namespace std; void printGame(char gameGrid[]); void inputToSlot(char gameGrid[], int slot, char choice); void initialiseGame(char gameGrid[]); bool isFull(char gameGrid[]); bool isEmpty(char input); bool checkWon(char gameGrid[]); bool rowWon(char gameGrid[]); bool columnWon(char gameGrid[]); bool diagonalWon(char gameGrid[]); int main(int argc, const char * argv[]) { char gameGrid[GRID_SIZE]; initialiseGame(gameGrid); int currentTurn = 0; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.