ahistogram.h
--------------
line 7: There is no reason for aHistogram to inherit aDie. The relationship does not pass the "is a" test. A histogram is NOT a die.
Line 14: You don't need a 12,000 entry vector here. A simple array of 6 ints is all that is needed.
Line 16: Why do you have a vector here? You don't use (or need) it.
Line 17: Why is face a member? A histogram doesn't have a face.
ahistogram.cpp
----------------
line 11: What is the purpose of calculating face here? A histogram does not have a face.
Lines 24-30: Do you really need to display all 12,000 rolls? If so, a better place to do this would be in your loop in main.
Lines 32-43: You're trying to use your histogram for two different purposes. Lines 26-29, you're trying to display the value of all 12,000 rolls. Here, you're trying to display how many times each face is rolled. Those are two different things and you should not be using the same vector to do both.
main.cpp
---------
Lines 14-15: There is no reason for aDie and aHistogram to by dynamic. You have a memoy leak because to don't release them.
Line 15: Don't call your histogram Die2. It's a histogram, not a die.
Line 16: There is no reason to create a 12000 entry vector. What you're trying to measure is how many times each of the faces (1-6) is rolled. A simple array of 6 ints will suffice.
Line 18: What is the purpose of die1? You don't use it.
Your aDie::Roll function (from other thread) needs to return the face (value of the roll).
Line 23-24: This should be:
1 2 3 4
|
int face;
face = aDie.Roll();
histogram.update (face);
|