1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
const int NumMarbles[] = {5, 8, 4};
const int NumColours = sizeof (NumMarbles) / sizeof NumMarbles[0];
const int NumMarblesAdded[][NumColours] = {{1,2,3}, {2,0,1}, {2,1,2}};
const int NumDraws = 5;
class ProbabilityTree {
public:
ProbabilityTree (const int _numMarbles[], const int _numMarblesAdded[][NumColours], int _numDraws, int _numColours):
numMarbles (_numMarbles), numDraws (_numDraws), numColours (_numColours)
/*, numMarblesAdded (_numMarblesAdded)*/ {
numMarblesAdded = new int*[numColours];
for (int i = 0; i < numColours; i++)
for (int j = 0; j < numColours; j++)
{
numMarblesAdded[i] = new int[numColours];
numMarblesAdded[i][j] = _numMarblesAdded[i][j];
}
}
private:
const int numColours;
const int *numMarbles;
int **numMarblesAdded;
const int numDraws;
};
int main () {
ProbabilityTree tree (NumMarbles, NumMarblesAdded, NumDraws, NumColours);
return 0;
}
|