Question: void play ( Player &player 1 , Player &player 2 ) { int answer = rand ( ) % 1 0 0 ; bool win
void playPlayer &player Player &player
int answer rand;
bool win false;
while win
win checkForWinplayer answer;
if win
playerendRoundtrue;
playerendRoundfalse;
return;
win checkForWinplayer answer;
if win
playerendRoundfalse;
playerendRoundtrue;
bool checkForWinPlayer &player, int answer
bool win false;
cout player.getNames turn to guess." endl;
int guess player.getGuess;
cout "You guessed guess ;
if answer guess
cout "You're right! You win!" endl;
win true;
else
player.wrongGuessguess answer;
return win;
Notice how we have Player objects used in these functions! This is the first class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
