Write a program to read in a tic-tac-toe board

Assignment Help Computer Engineering
Reference no: EM132196712

Write a C++ program to read in a Tic-Tac-Toe board, make a move, then save the board back to the file.

Input:

The input will be given on the command line. The first argument is the name of the file containing the game board. The second argument is the letter of who to move as, X or O.

$ ./project game_board.dat X
If the letter provided is 'X' (case-INsensitive), play as the letter 'X'. Any other letter will result as playing as 'O'.

Game Board File:

The file holding the game board is made up of 3 lines, 4 chars each. The first 3 chars of a line representing the row of the TTT board. The last char is "\n".

The 3 chars for the rows of the TTT board may be 'X', 'O', or space.

Here is an example:

$ cat board.dat X O OX X $
Output:

The output of your project 4 should be:

1. The resulting game board after your move

2. Who won, tie game, else nothing.

Example:

$ cat board.dat X O O X $ ./project4 board.dat X X O OX X X Wins! $
Execution:

Your program, when launched with the above command-line parameters, should:

Obtain the game board file name and player to move as

Read in the game board

Make a move as the specified player

Save the resulting game board to the same file.

State a winner or tie, if applicable

Quit

Reference no: EM132196712

Questions Cloud

Effective and lead to sustainable competitive advantage : Under what conditions would a different strategy across national borders be effective and lead to a sustainable competitive advantage?
Create an array of doubles and pass it to sort : Write C program with sort1 function: void sort(const double a[], unsigned els);
Focus your expansion strategy : Identify five or six industry key success factors of this market niche that may help you to focus your expansion strategy.
Write down model for competitive balance : The handbook chapter on competitive balance discusses a two team model for competitive balance in a sports league. Set up the two team, fixed talent model.
Write a program to read in a tic-tac-toe board : Write a C++ program to read in a Tic-Tac-Toe board, make a move, then save the board back to the file.
Literature on the integrated customer experience : Review the current literature on the Integrated Customer Experience and write a literature review which could be suitable for publication in an academic
What were positives and negatives related to the color : What were positives and negatives related to the color of their skin that was still an issue in most of their experiences.
Write a c program to solve a single quadratic equation : Reading of coefficients a, b, c shall be done by calling a function named readCoeffs(), once for each coefficient.
Purpose for conducting employee orientation : Identify the reasons and purpose for conducting employee orientation.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain how your questions help you understand

User interviews can be useful in user experience design. There are many different questions that can be asked, but your goals may only require a few of them.

  Describe efficient algorithm to find the longest palindrome

Describe efficient algorithm to find longest palindrome that is suffix of string T of length n. Recall that apalindrome is string that is equal to its reversal.

  Create an instance of roomcarpet and ask the user

Carpet Calculator. This problem starts with the FeetInches class that is provided in the course Content area on the assignment page for this week.

  Developing and implementing an it compliance program

Your plan should provide practical knowledge on what you should consider when developing and implementing an IT compliance program for key regulations.

  Explain your desire method to perform vulnerability analysis

CIS420- Analyze potential security concerns, and identify what you believe to be the greatest concerns in terms of vulnerabilities. Describe the method you would use to identify the related exploit. Explain your desired method to perform this vuln..

  Questionyour microsoft windows 2000-based office network

questionyour microsoft windows 2000-based office network has three domains- alpha beta and omega all in the similar

  How to add and use a menu control on the form

How to add and use a menu control on the form. Develop a "Grade Report" project, which allows user to create a sequential file or open an existing file, then save test scores in this file.

  How to classify emerging technologies

How to classify emerging technologies Inscribe obviously and succinctly about information management systems using proper writing mechanics.

  Define word protocol and explain how it is used in computing

Define the word protocol and explain how it is used in computing. Distinguish between machine language and assembly language.

  Describe an efficient algorithm to find the minimum length

Draw a joint suffix tree for three strings ACTAC, ATCAT, TCACT. Label the edges and terminal nodes.

  Write a program that simulates a lotto

Write a program that simulates a Lotto 6/49. The program should have an array of six integers named lottoNumbers.

  Build a word document listing the software

The scenario is that you do volunteer work for the small, self-funded community support group. With very little money available, the group has been unable to computerize its operations.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd