Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming: Write a program to play the game of 21 between a user and computer. Play as long as the user rolls the dice

C++ Programming:

Write a program to play the game of 21 between a user and computer. Play as long as the user rolls the dice and the total of user or computer does not exceed 21.

Example: computer's total is 24; user's total is 18 => the game must end and declare the winner. See sample output below.

The program must have THREE files.

Specification file for the Die class - file name: Die.h

Implementation file for the Die class - file name: Die.cpp

Main or driver file to run the program - file name: Die_Test.cpp

image text in transcribed

Let's play a game of 21 ! Would you like to roll the dice? Enter Y for yes or N for no: y You have 7 points. Computer has 6 points. Would you like to roll the dice? Enter Y for yes or N for no: y You have 16 points. Computer has 15 points. Would you like to roll the dice? Enter Y for yes or N for no: y You have 18 points. Computer has 24 points. Would you like to roll the dice? Enter Y for yes or N for no: n The computer had 24 points. You had 18 points. Congratulations! You won! Game Over

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

a score of 60 or higher on the test?

Answered: 1 week ago

Question

Lo6 Identify several management development methods.

Answered: 1 week ago