Write a program that deals a number of cards (their numerical values) to a player's hand. To begin, the program asks the player for the values of the deck of cards.   Then, the program deals the first two cards of the deck to a player's hand, and asks him if he wants another card. If he does not want a card, the program ends. If he wants a card, the program deals the next available card in the deck, adds it to the player's hand, and asks the player if he wants another card. The dealing process repeats as long as the user continues to accept cards, or until the cards in the deck run out.     Card dealing involves copying the available card from the deck vector to another vector, which stores the player's hand, at the next available position.    Assume that the deck of cards consists of only 10 cards with numerical values from 1 to 10, which the player will enter by keyboard before the program deals.    The following functions must be implemented/used:      enterDeckValues. - This function will receive two parameters: a vector that will store the numerical values of the deck of cards, and the number of cards in the deck. The function will fill the deck vector with the numerical values to be entered by keyboard.      dealCards. - This function will receive three parameters: a vector that will store the numerical values of the deck of cards; the total number of cards in the deck; and, the vector that will store the numerical values of the player's final hand. The function will assign the first two cards of the deck to the player's hand and then deal cards to the player, assigning numerical values of the available cards in the deck, as explained in the approach.      printVector - This function will receive two parameters: a vector and its dimension. The function will print the vector, and will serve to print the values (the vector) of the initial hand and the final hand. I attach screenshots of how it should be executed Translator

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that deals a number of cards (their numerical values) to a player's hand. To begin, the program asks the player for the values of the deck of cards.  

Then, the program deals the first two cards of the deck to a player's hand, and asks him if he wants another card. If he does not want a card, the program ends. If he wants a card, the program deals the next available card in the deck, adds it to the player's hand, and asks the player if he wants another card. The dealing process repeats as long as the user continues to accept cards, or until the cards in the deck run out.    

Card dealing involves copying the available card from the deck vector to another vector, which stores the player's hand, at the next available position.   

Assume that the deck of cards consists of only 10 cards with numerical values from 1 to 10, which the player will enter by keyboard before the program deals.   

The following functions must be implemented/used: 

    enterDeckValues. - This function will receive two parameters: a vector that will store the numerical values of the deck of cards, and the number of cards in the deck. The function will fill the deck vector with the numerical values to be entered by keyboard. 

    dealCards. - This function will receive three parameters: a vector that will store the numerical values of the deck of cards; the total number of cards in the deck; and, the vector that will store the numerical values of the player's final hand. The function will assign the first two cards of the deck to the player's hand and then deal cards to the player, assigning numerical values of the available cards in the deck, as explained in the approach. 

    printVector - This function will receive two parameters: a vector and its dimension. The function will print the vector, and will serve to print the values (the vector) of the initial hand and the final hand.

I attach screenshots of how it should be executed

Translator
 
 
 

 

 

Expected output 1:
Terminal
Distribution of cards
Enter the card deck values: 3 5 3 7 10 4
Starting hand: 3 5
He wants letter (y/n): n
Final hand: 35
Goodbye
Expected output 2:
Terminal
Distribution of cards
Enter the values of the deck of cards: 78 79 14 79 38
Starting hand: 7 8
He wants letter (y/n): s
Updated hand: 787
He wants letter (y/n): s
Updated hand: 78 79
He wants letter (y/n): s
Updated hand: 78 79
He wants letter (y/n): n
Final hand: 7 8 7 9 1
Goodbye
+7938
1
Transcribed Image Text:Expected output 1: Terminal Distribution of cards Enter the card deck values: 3 5 3 7 10 4 Starting hand: 3 5 He wants letter (y/n): n Final hand: 35 Goodbye Expected output 2: Terminal Distribution of cards Enter the values of the deck of cards: 78 79 14 79 38 Starting hand: 7 8 He wants letter (y/n): s Updated hand: 787 He wants letter (y/n): s Updated hand: 78 79 He wants letter (y/n): s Updated hand: 78 79 He wants letter (y/n): n Final hand: 7 8 7 9 1 Goodbye +7938 1
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education