Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Problem Statement – You are to create a program to play Tic-Tac-Toe.  The program should initially explain that this program is a Tic-Tac-Toe game. The program must include the following:

  1. The board must be represented as a one dimensional array.
  2. The board must be printed after each user selects a position on the board.
  3. Directions must be printed to the screen. The directions should include a copy of the board with each position labeled in the board. 
  4. The game should allow two players to alternate providing their selected position. The first player will be using ‘X’ and the second player will be using ‘Y’.
  5. The program should include the following functions:
    1. void printDirections ( ) Provides directions on how to play the game
    2. int getBoardPosition( int player) This function prompts for the player to input the position of the board and returns the position.
    3. void printBoard (char board [ ] ) This function prints the updated board with the input of the player.
    4. int isWinner ( char board [ ]) returns 0 if there is no winner and either 1 or 2 to indicate which player has won the game.
    5. The int main () should contain a loop to allow the inputting of board selection by the players and the printing of the updated board after each play.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education