C program to implement monty hall game


Question 1) Write a C program that acts as a monty hall game host that continuously hosts the game and the user of the program acts as the player. The program would loop over the playing of this game.

1) In every game, doors are labelled by 1,2 and 3 respectively. A game begins by putting the prize behind the door at random, then prompts the user to pick a number from {1,2,3}, that indicates the user picks.

2) Program then decides a door to open. The door should be one behind which there is no prize and that is not picked by the user.

3) In case there are two such doors available, program picks one at random. Program next prompts the user to decide if he wants to switch.

4) Based on the user’s decision, program outputs if a user won the prize or not. The loop over game play finishes if the user picks the invalid door number, as in a number outside {1,2,3}, at the beginning of a game. When the loop is over, program outputs the total number of games which have been played, number of games in which the user has won, and the relative frequency winning.

5) Then write the second program which stimulates the playing of two games by two specific users, first user consistently decides on "switch" and second user consistently decides on "not switch". For each user, 10000 game plays would be stimulated, and in each game, the initial pick by a user is made random, the program should print how many games each user has won and winning frequencies for each user.

6) The program outputs total number of games which have been played, the number of games in which the user has won, and the relative.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: C program to implement monty hall game
Reference No:- TGS04705

Expected delivery within 24 Hours