Dice rolling problem

The questions is "Chevalier de Blasé, a notorious 17th century gambler, wanted to know whether he had higher odds of winning a dice game with four dice, where a win meant a pair of 5s and a pair of 6s, or a game with six dice, where a win meant four sixes (and two dice that are not a six).

Basically I need to find which of these two games have higher chance to win by "actually" throw the dice.

#include <cstdlib>
#include <iostream>

using namespace std;
int die_toss()
{
return 1 + rand() % 6;
}

int game1_wins(int a, int b, int c, int d) //This is where I got stuck
{
}

I was thinking write it like this if(((a=5,b=5) && (c=6,d=6)) || ((a=5,c=5)..and so on, there's like 6 possibilities. But I feel like I am going to the wrong direction.
Four or six separate variables is worse than one array. With the array you can count: http://www.cplusplus.com/reference/algorithm/count/

Two 5's and two 6's. Clear to count, although perhaps not the most efficient.

Does the game of six dice has to have exactly four or at least four?


The question has exact analytical solution; there is no need for random sampling. However, if that is what you have to do, then so shall it be.


You are learning, yes? Then do not learn the rand(). It has been deprecated; marked for removal.
Learn the <random>. For example: http://www.cplusplus.com/reference/random/uniform_int_distribution/
I think it's exactly 4 fours for game2
Topic archived. No new replies allowed.