Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm stuck on how to get started on this programming assignment. I need to create a class Game and a class Person as indicated in

image text in transcribed

I'm stuck on how to get started on this programming assignment. I need to create a class Game and a class Person as indicated in the instructions. I also need to use pointers within the Game class. I would appreciate a code sample that isn't too advanced and follows the guidelines in the picture. The language is C++. Thank you!

PIC 10B Homework 1 Due Wednesday, Jan. 22 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 gones: 2 Player 1 None - Karl Player 2 None = Sof ia Tic Toc Toe Karl (X) - Sof ia (0) Sof ia vins this round Kar 10 Sof ia 1 2 Congratulat ions Sofia , Vou 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. PIC 10B Homework 1 Due Wednesday, Jan. 22 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 gones: 2 Player 1 None - Karl Player 2 None = Sof ia Tic Toc Toe Karl (X) - Sof ia (0) Sof ia vins this round Kar 10 Sof ia 1 2 Congratulat ions Sofia , Vou 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

New Trends In Databases And Information Systems Adbis 2019 Short Papers Workshops Bbigap Qauca Sembdm Simpda M2p Madeisd And Doctoral Consortium Bled Slovenia September 8 11 2019 Proceedings

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Robert Wrembel ,Mirjana Ivanovic ,Johann Gamper ,Mikolaj Morzy ,Theodoros Tzouramanis ,Jerome Darmont

1st Edition

3030302776, 978-3030302771

More Books

Students also viewed these Databases questions

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago