-1

Write an interactive program C that plays tic-tac-toe. Represent the board as a three-by-three character array. Initialize the array to blanks and ask each player in turn to input a position. The first player's position will be marked on the board with an O, and the second player's position will be marked with an X. Continue the process until a player wins or the game is a draw. To win, a player must have three marks in a row, in a column, or on a diagonal. A draw occurs when the board is full and no one has won. Each player's position should be input as indices into the tic-tac-toe board that is, a row number, a space, and a column number. Make the program user friendly. After each game, print out a diagram of the board showing the ending positions. Keep a count of the number of games each player has won and the number of draws. Before the beginning of each game, ask each player if he or she wishes to continue. If either player wishes to quit, print out the statistics and stop.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.