Question: #include #include #include using namespace std; class Die { private: int sides; // Number of sides int value; // The die's value public: Die(int =

#include #include #include using namespace std;

class Die { private: int sides; // Number of sides int value; // The die's value public: Die(int = 6); // Constructor int roll(); // Rolls the die int getSides(); // Returns the number of sides int getValue(); // Returns the die's value }; Die::Die(int numSides) { // Get the system time. unsigned seed = time(0); // Seed the random number generator. srand(seed); // Set the number of sides. sides = numSides; } int Die::roll() { // Constant for the minimum die value const int MIN_VALUE = 1; // Minimum die value // Get a random value for the die. value = (rand() % (sides - MIN_VALUE + 1)) + MIN_VALUE; return value; } int Die::getSides() { return sides; } int Die::getValue() { return value; } int main() { srand(time(0)); Die d1, d2; int user = 0; int computer = 0; while(true) { char ch; cout >ch; if(ch != 'y') break; computer +=d1.roll() + d2.roll(); user += d1.roll() + d2.roll(); cout 21) break; } cout computer) { cout

Please fix the code above, add in the use of pointers, classes, structures, and files. Such as saving each result after each round of the game into a txt file (win/lost). Change the coding, make sure that pointers are used. Thank you for the help.

The requirements in the image are not enough

#include #include #include using namespace std; class Die { private: int sides;

Thanks again, sincerely.

A Game of 21 For this assignment, you will write a program that lets the user play against the computer in a variation of the popular blackjack card game. In this variation of the game, two six-sided dice are used instead of cards. The dice are rolled, and the player tries to beat the computer's hidden total without going over 21. Here are some suggestions for the game's design: For this assignment, you wil wnte a program that lets the user play against the computer in a Each round of the game is performed as an teration of a loop that repeats as long as the player Each round of the game is performed as an iteration of a loop that repeats as long as the player agrees to roll the dice, and the player's total does not exceed 21. to roll the dice, and the player's total does At the beginning of each round, the program will ask the users whether they want to roll the dice to accumulate points. During each round, the program simulates the rolling of two six-sided dice. It rolls the dice first for the computer, and then it asks the user if he or she wants to roll. (Use the Die class that was demonstrated in this chapter to simulate the dice). The loop keeps a running total of both the computer and the user's points. The computer's total should remain hidden until the loop has finished After the loop has finished, the computer's total is revealed, and the player with the most points without going over 21 wins

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!