Give the value and the type of each expression listed below:
"You are on a game show on television. On this game show the idea is to win a car as a prize. The game show host shows you three doors. He says there is a car behind one of the doors and there are goats behind the other two doors. He asks you to pick a door. You pick a door but the door is not opened. Then the game show host opens one of the doors you didn't pick to show a goat (because he knows what is behind the doors). Then he says that you have one final chance to change your mind before the doors are opened and you get a car or a goat. So he asks you if you want to change your mind and pick the other unopened door instead. What should you do?"The correct solution to this problem is counter-intuitive. When the question was first posed and solved in 1990, by Marilyn vos Savant, many people wrote letters to say that she was wrong, including mathematicians and scientists with PhDs!
First try solving the problem using your intuition. Then write a C program called monty_hall.c to simulate the problem, and estimate the probabilities of winning the car by the two decisions: sticking with the first door you pick, or picking the other unopened door. You can assume, without loss of generality, that the contestant always picks the same door at the beginning (say door A). The car is assigned randomly to one of three doors, and the host opens one of the other two doors (if the car is behind door A, the host will open door B or door C with equal probability). Your program must prompt the user for a seed for the random number generator (rand, available in stdlib.h; type man rand for more details) and the number of games played, and then output the number of games won if the contestant always sticks to his/her first pick and the number of games won if the contestant always switches doors. Run the program with several different random number seeds and different numbers of games played to verify that the result is always approximately the same. Comment on the result: did it agree with your own solution to the problem?