77 474
Assignments Done
Successfully Done
In July 2019

Answer to Question #32369 in C++ for amal

Question #32369
Write a program that simulates the Monty Hall Game. Don't forget to validate user input and use functions, in addition to main() to perform major tasks.

The Monty Hall Game is named after a host of a television game show from the 70's in which a contestant could win a new car by guessing the right door that the car was behind. It became a popular puzzle because the best playing strategy in counterintuitive. Here is how the game works:
• The contestant chooses one door.
• Then Monty opens one of the other doors that does NOT have the car behind it.
• At this point in the game, the contestant has the option of changing his or her choice to the third door.
1. In this game you will need to generate a random number representing the door that has the car behind it. Your program must be able to generate a random integer between 1 and 3. To do this, you will need to perform the three steps below:
Step 1: You must include the following two header files at the beginning of the program in your library/header file directives.
#include <time.h>
#include <stdlib.h>

Step 2: The seed and srand must be initialized at the beginning of your main program as follows:
unsigned seed;
seed =time(NULL);

Step 3: Use the following expression when you need to generate a random number from 1 to 3:
(rand() % 3) + 1;
Expert's answer

Not answered

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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions