Answer to Question #164387 in C++ for Meow Hunter

Question #164387

Create a puzzle of guessing game of three boxes in which a player could win a prize by guessing the right box that the prize was behind. One player choose one box, and the game virtual assistant opens one of the other box that does not have the prize behind it. At that point in the game, the player has the option of changing his choice to the third box to win the prize. This game can be demonstrate using conditional probabilities.


1
Expert's answer
2021-02-17T14:55:27-0500
 #include <iostream>
#include <stdlib.h>
#include <ctime>
Using namespace std;
int main() {
Into b;
cout<< "Enter your number"<<endl;
cin>>b;
  srand((unsigned) time(0));
    Cout<<" playing "<<endl;
    int result = 1 + (rand() % 3);
    if(b==result){
Cout<<"you won"<<endl;
}else{
Cout<<"lost"<<endl;
}
   
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment