Question: c++ program The code you might be use: if (answer == guess) { cout else if (answer else { cout void play(Player &player1, Player &player2)
c++ program


The code you might be use:
if (answer == guess) { cout
else if (answer
else { cout
void play(Player &player1, Player &player2) {
int answer = rand()%100;
int guess = 0;
bool win = false; while (!win) {
cout
guess = player1.getGuess(); win = checkForWin(guess, answer);
if (win) return; cout
win = checkForWin(guess, answer); } }
Part of the code to play a guessing game is listed below. In the game, two players attempt to guess a number that has been preselected with a value between 0 and 99 (inclusive). The first player to correctly guess the number wins. Your task is to extend the program with objects that represent either a human player or a computer player. Recall, the rand0 function requires you to include the cstdlib of your textbook for information on random number generation) bool checkForWin (int guess, int answer) cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
