Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ !!!!C++ programming for tic-tac-toe using pointers ! In C++ please Problem 1: Write code to play a Tic-tac-toe tournament. Tic-tac toe is a game

C++ !!!!C++ programming for tic-tac-toe using pointers ! In C++ please

image text in transcribed

Problem 1: Write code to play a Tic-tac-toe tournament. Tic-tac toe is a game for two players who take turns marking the spaces with Xs and Os in a 3x3 grid. The purpose of the game is to place three of your marks in a horizontal, vertical or diagonal. You can use three vectors of strings to make up the 3x3 grid and modify it as the players enter their marks. Create a class called Game to store player information and perform the Tic-tac-toe games. Create a class Person that includes a name and a running score. The Game class should have fields for the players, all of which should be pointers to a Person object. Write a main function that prompts the user for the name of the players and the number of games to play, then runs the games, and finally shows the overall winner. Compile your code and run your program to check for compile-time errors and logic errors. Figure 1 shows beginning and ending frames of a sample output. Number of games: 2 Player 1 Name = Karl Player 2 Name = Sofia Tic Tac Toe Karl (X) - Sofia (0) 1 2 3 1 2 3 1 X i 0 i X 2 X I 0 Sofia wins this round Karl : 0 Sofia : 2 Congratulations Sofia . You won! Karl (X) Mark Location: 11 Figure 1: Sample output for Homework 1 Things to have for sure on the hmw1 code: code doesn't take wrong coordinates. code doesn't take already marked coordinates. players must be pointers. code doesn't crash if people input letters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions