1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Step2247 [10]
3 years ago
5

Write a program that scores a blackjack hand. In blackjack, a player receives from two to five cards. (The player decides how ma

ny, but that has no effect on this exercise.) The cards 2 through 10 are scored as 2 through 10 points each. The face cards, jack, queen, and king are scored as 10 points. The goal is to come as close to a score of 21 as possible without going over 21. Hence, any score over 21 is called "busted." The ace can count as either 1 or 11, whichever is better for the user. For example, an ace and a 10 can be scored as either 11 or 21. Since 21 is a better score, this hand is scored as 21. An ace and two 8' s can be scored as either 17 or 27. Since 27 is a "busted" score, this hand is scored as 17.
Computers and Technology
1 answer:
Anastaziya [24]3 years ago
8 0

Answer:

C++ code is explained below

Explanation:

#include <iostream>

using namespace std;

void instructions ( );

void input (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5);

int calculate_hand (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5);

void output_result ( );

int main ( )

{

char yes;

int number_of_cards;

char card_value1;

char card_value2;

char card_value3;

char card_value4;

char card_value5;

instructions ( );

do{

input (number_of_cards, card_value1, card_value2, card_value3, card_value4, card_value5);

cout << "Again? (y/n)" << endl;

cin >> yes;

cout << endl;

}while (yes == 'Y' || yes == 'y');

system ("Pause");

return 0;

}

void instructions ( )

{

cout << "This program scores a blackjack hand. The user is asked how many cards" << endl;

cout << "he or she has, and the card values. This program will then output the user's" << endl;

cout << "scores. The output will be either: a number between 2 and 21, or the word BUSTED" << endl << endl;

cout << "The values of the cards should be inputted as the following: input the numbers" << endl;

cout << "2-9 just as inputting regular numbers, for the number 10 input 't', for jack" << endl;

cout << "input 'j' for queen input 'q', for king input 'k', and for ace input 'a'" << endl << endl;

}

void input (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5)

{

cout << "Please input the number of cards in your hand (either 2, 3, 4, or 5)" << endl;

cin >> number_of_cards;

cout << endl;

if (number_of_cards == 2)

{

cout << "Please input the value of the first card: " << endl;

cin >> card_value1;

cout << "Please input the value of the second card: " << endl;

cin >> card_value2;

cout << endl << endl;

}

else if (number_of_cards == 3)

{

cout << "Please input the value of the first card: " << endl;

cin >> card_value1;

cout << "Please input the value of the second card: " << endl;

cin >> card_value2;

cout << "Please input the value of the third card: " << endl;

cin >> card_value3;

cout << endl << endl;

}

else if (number_of_cards == 4)

{

cout << "Please input the value of the first card: " << endl;

cin >> card_value1;

cout << "Please input the value of the second card: " << endl;

cin >> card_value2;

cout << "Please input the value of the third card: " << endl;

cin >> card_value3;

cout << "Please input the value of the fourth card: " << endl;

cin >> card_value4;

cout << endl << endl;

}

else if (number_of_cards == 5)

{

cout << "Please input the value of the first card: " << endl;

cin >> card_value1;

cout << "Please input the value of the second card: " << endl;

cin >> card_value2;

cout << "Please input the value of the third card: " << endl;

cin >> card_value3;

cout << "Please input the value of the fourth card: " << endl;

cin >> card_value4;

cout << "Please input the value of the fifth card: " << endl;

cin >> card_value5;

cout << endl << endl;

}

}

int calculate_hand (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5)

{

}

You might be interested in
IN C++
Natali [406]

Answer:

I only do Design and Technology

sorry don't understand.

4 0
3 years ago
owever, sitting in a corner of the store, a hacker had just set up an open "rogue" wireless hotspot posing as the coffee shop’s
Ivenika [448]

However, sitting in a corner of the store, a hacker had just placed up an open “rogue” wireless hotspot posing as the coffee shop’s wireless network. When Sarah logged onto her bank’s website, the hacker hijacked her session and gained access to her bank accounts. Another term for rogue wireless hotspots exists as “evil twin” hotspots.

<h3>What is meant by wireless network?</h3>

A computer network is referred to as a wireless network if radio frequency (RF) links are used to connect network nodes. A common solution for households, companies, and telecommunications networks is wireless networking. Wi-Fi is a wireless networking technology that enables printers and video cameras to connect to the Internet as well as computers (laptops and desktops), mobile devices (smart phones, wearables, etc.), and other devices.

Increased Mobility: Wireless networks give mobile users access to real-time data, enabling them to move freely across the premises of your firm without losing network connectivity. This improves collaboration and production across the entire organisation, which is not achievable with traditional networks.

Hence, However, sitting in a corner of the store, a hacker had just placed up an open “rogue” wireless hotspot posing as the coffee shop’s wireless network. When Sarah logged onto her bank’s website, the hacker hijacked her session and gained access to her bank accounts. Another term for rogue wireless hotspots exists as “evil twin” hotspots.

To learn more about wireless network refer to:

brainly.com/question/26956118

#SPJ4

6 0
1 year ago
Which of these is a benefit of using the Sort option?​
Reika [66]

There are many benefits of using the shot options in Excel. Some benefits are allowing you to short by number,date,color, letter, columns,or text. This benefits the user because it allows the user to bring data up more easily.

I hope this answers is helpful

3 0
3 years ago
What do you do to think positive and maintain discipline to play
Agata [3.3K]

Answer:

to make peaceful mind.to develop our character..

6 0
3 years ago
In general, the pilot and _______ approaches are the most favored conversion approaches.
Karo-lina-s [1.5K]

Answer:

The correct approach is "Phased".

Explanation:

  • The pilot step requires just to validate the development's implementation goals and objectives and then when the SDMX objects were introduced to development, several perhaps all problems have indeed been detected as well as logged through so that they're being corrected either by the detailed technical advisory committee.
  • The staggered or phased approach towards deployment provides the time possible to obtain the very next knowledge on evaluation criteria, staff including diverse cultures such that the strategy produced could be customized accordingly.
6 0
2 years ago
Other questions:
  • This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
    13·1 answer
  • . What may happen if a large number of computer users are attempting to access a Web site at the same
    10·2 answers
  • Write a program that calculates the cost of a phone call. The user enters a positive integer that
    11·1 answer
  • When the minnesota timberwolves encouraged facebook fans to post a great shot of a dunk onto its pinterest page for a chance to
    6·1 answer
  • A hub transmits all incoming messages to all of its ports except the port where the messages came in. A switch usually sends mes
    14·2 answers
  • no one can succeed in his or her career without relying on others for help or opportunities. It’s best, though,
    13·1 answer
  • You buy a new workstation that features an embedded RAID controller on the motherboard. You want to setup hardware RAID 10. How
    10·2 answers
  • If a employee has a grade grater than or equal to 18, then he she will get 50% bonous on the basic pay. Otherwise, the employee
    5·1 answer
  • What is the setting an alarm clock output??
    10·1 answer
  • Who is responsible for the actions of autonomous systems? (please help me :C)
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!