Question
In C++ How do I create a game which simulates a basketball shooting? The game must be played with two players. Each player will simulate
In C++
How do I create a game which simulates a basketball shooting?
The game must be played with two players.
Each player will simulate shooting the basketball.
If one player hits their shot while the other misses their shot, the player that missed the shot collects a letter beginning with the letter H of the word HORSE and iterating through each letter for each subsequent miss.
If both players hit their shot, or both miss their shot, we continue to the next round.
The game continues until one player has collected all of the letters necessary to spell the word HORSE.
C++ program must contain files named as Game.cpp, Player.cpp
Game class must store two Players on the Heap.
Player class must use a character array to store the word
Can use a random number generator to generate whether or not the Player hits the shot assume each Player has a 50% shooting percentage as a default.
When a game finishes we should prompt the user if they would like to play again. The options should be Y or N. ( case sensitive).
Output should look like below;
Player #1: Hit Shot!
Player #2: Hit Shot!
Player #1: Missed Shot!
Player #2: Hit Shot!
Player #1: Added an 'H'
Player #1: Hit Shot!
Player #2: Missed Shot!
Player #2: Added an 'H'
Player #1: Missed Shot!
Player #2: Hit Shot!
Player #1: Added an 'O'
Player #1: Hit Shot!
Player #2: Missed Shot!
Player #2: Added an 'O'
Player #1: Hit Shot!
Player #2: Missed Shot!
Player #2: Added an 'R'
Player #1: Missed Shot!
Player #2: Hit Shot!
Player #1: Added an 'R'
Player #1: Missed Shot!
Player #2: Missed Shot!
Player #1: Hit Shot!
Player #2: Missed Shot!
Player #2: Added an 'S'
Player #1: Missed Shot!
Player #2: Missed Shot!
Player #1: Missed Shot!
Player #2: Hit Shot!
Player #1: Added an 'S'
Player #1: Missed Shot!
Player #2: Missed Shot!
Player #1: Hit Shot!
Player #2: Missed Shot!
Player #2: Added an 'E'
Player 1 Wins :: Player 2 = HORSE
Would you like to play again (Y|N)? :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started