need help! (c/c++ lets make a deal/monty hall problem)
Hi, I am fairly new to c programming and am currently having problems with the "monty hall problem." I will type it up a few lines down. Basically I do not know where to start and was hoping you guys would have some ideas for me. Maybe outlining how the function should operate if that is possible. Anyways, here is the problem, and any help is really appreciated. Thanks!
There are 3 doors, behind 1 door is a prize and behind the other 2 are goats (not prizes). The player selects one of the doors. The host knows what is behind each door. The host opens another door not selected by the player. If the player selects a door with a goat behind it, the host has to open the door with the other goat. If the prize is selected by the player, the host can pick either door. Now the player makes a choice, either to stay with his/her door or to switch to the remaining closed door. I am supposed to write a program to simulate the game, and run it 10,000 iterations, 100,000 iterations, and 1,000,000 iterations, always keeping track of the number of wins/losses. It should turn out about 60% of the time the player wins by switching doors.
Re: need help! (c/c++ lets make a deal/monty hall problem)
declare an array to have 3 elements (int doors;)
each one will represent a door
fill the above array randomly(use srand,rand ) with the numbers 1,2,3
do this first ,post your code and i will help you.
|All times are GMT +5.5. The time now is 18:38.|