Hi, can someone look at this code and tell me if it matches the
requirements. I need to write this program which simulates a game
where a player throws 5 dice and can reroll all of the dice (all
or none) if the player wants. A player can only reroll all the dice
once but does not have to do the reroll. After the original roll and
after possibly rerolling all the dice the sum of all the dice is the
players score. The dice are a little unusual. The first one only has
4 sides, the second has 5 sides, the third has 6 sides,the fourth has
seven sides and the fifth has eight sides. The sides of the first die
are numbered from 1 to 4. The sides of the second die are numbered from
1 to 5, etc.
This is my code:
---Die.h------
class Die
{
public:
Die(); //Default constructor
Die(int sides); //Explicit value constructor
void Print(); //Prints a test
~Die(); //Destructor
void roll();
void conditionalReRoll();
int getValue();
private:
int value;
int numberOfSides;
};
---Die.cpp------
Die::Die()
{
//cout<<"Hello, It's good to be alive."<<endl;
value=0;
numberOfSides=6;
}
Die::Die(int sides)
{
//cout<<"Hello, It's good to be alive."<<endl;
value=0;
numberOfSides=sides;
}