Monty Hall problem in c++

So my assignment is to solve the monty hall problem, which i am sure you guys know already. Here's my code so far, and I'll explain where did I got stuck

#include <iostream>
#include <fstream>

using namespace std;
typedef int Door;

const int SIMULATION_COUNT = 100;

void simulate( ... );( given by professor)

Door hideCar();

Door openDoor();

Door makeFirstChoice();

Door makeSecondChoice();
int hideCar()
{
return 1 + rand() % 3;
}
int makeFirstChoice()
{
return 1 + rand() % 3;
}

after the first choice, Monty are suppose to "open" one other door of the remaining doors. And I am not sure how to do that. Any help will be appreciated, thanks!
Last edited on
Monty knows.

Monty knows your first choice and where the car is.

If your choice has a car, then Monty randomly picks one of the two doors.

If your choice does not have a car, then Monty picks exactly the remaining door that does not have a car.
As funny as it sounds: The open door is irrelevant:

Pseudo code:

win_door = 1,2,3
choice_door = 1,2,3
stick_to_your_choice = 0,1

if stick_to_your_choice
  if win_door == choice_door
    You win
  else
    You loose
else
  if win_door == choice_door
    You loose
  else
    You win
Thanks guys, I understand the logic, but professor require us to have one column of output to be the opendoors( the one monty opens)...
Registered users can post here. Sign in or register to post.