Bool checkforwin(int guess, int answer)
{
if (answer == guess)
{
cout < &...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 12.12.2019 02:31 alodrascon175
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](/tpl/images/cats/User.png)
Answers: 1
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 10:30
What can tanya do now to start preparing for the college and scholarship application process? think about her grades, activities in which she can get involved, possible part-time jobs at which she can work, and standardized tests she can take. (10 points) apex
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 14:00
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 22:30
What are the 4 basic items that are traded throughout the world?
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/biologiya.png)
Biology, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
Mathematics, 05.05.2020 16:01
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/en.png)
English, 05.05.2020 16:01
![question](/tpl/images/cats/istoriya.png)
History, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.05.2020 16:01
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
Mathematics, 05.05.2020 16:01
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/health.png)
Health, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.05.2020 16:01
![question](/tpl/images/cats/mat.png)
Mathematics, 05.05.2020 16:01