subject

Bool checkforwin(int guess, int answer)
{
if (answer == guess)
{
cout < < "you're right! you win! " < < endl;
return true;
}
else if (answer < guess)
cout < < "your guess is too high." < < endl;
else
cout < < "your guess is too low." < < endl;
return false;
}
// the play function takes as input two player objects.
void play(player & player1, player & player2) {
int answer = 0, guess = 0;
answer = rand() % 100;
bool win = false;
while (! win)
{
cout < < "player 1's turn to guess." < < endl;
guess = player1.getguess();
win = checkforwin(guess, answer);
if (win) return;
cout < < "player 2's turn to guess." < < endl;
guess = player2.getguess();
win = checkforwin(guess, answer);
}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
Ihave buncha points. does anyone want any?
Answers: 1
question
Computers and Technology, 22.06.2019 06:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
question
Computers and Technology, 22.06.2019 11:30
What does a cascading style sheet resolve a conflict over rules for an element? a. the rule affecting the most content wins b. the rule affecting the most content loses c. the rule with the most specific selector loses d. the rule with the most specific selector wins
Answers: 2
question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
You know the right answer?
Bool checkforwin(int guess, int answer)
{
if (answer == guess)
{
cout < &...
Questions
question
Mathematics, 04.11.2020 14:00
question
Social Studies, 04.11.2020 14:00
question
Mathematics, 04.11.2020 14:00
Questions on the website: 13722367