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
When communicating with sockets, a client process initiates a request for a connection and is assigned a port by the host comput
melamori03 [73]

Answer:

D. 80

Explanation:

By default, the port number for a web server is 80.

3 0
4 years ago
Read 2 more answers
Search engines use indexes created by web _________ to provide fast searches.
Nastasia [14]
Search engines use indexes created by web crawlers to provide fast searches.
3 0
3 years ago
___ is a career discipline focusing on helping companies use computer technology effectively.
pickupchik [31]

Answer:

A (information technology)

Explanation:

4 0
2 years ago
Anyone help me with number 41.
Katarina [22]
It is te = t I yhink
8 0
3 years ago
Much has been made of the new Web 2.0 phenomenon, including social networking sites and user-created mash-ups. How does Web 2.0
konstantin123 [22]

Answer:

Explanation:

World Wide Web (www) has advanced as a major technology since its introduction during the 1980s. In beginning web sites were primarily used only by few number of users to share information related to their academic work. As the user interface evolved over the next coming years with each new version bringing in new frameworks and techniques, it powered web as a hub of technology. Web 1.0, 2.0 and 3.0 brought more dynamic features to the users. Web 1.0 used to describe the web content in static resulting in rigid user experience. Web 2.0 which powered social networking sites became popular developing the web which ultimately served as a platform for people to create and share their own content on the web in the form of blogs, wikis, feeds, tagging systems, user-created publication systems etc. The evolution of web technology began to spread its roots into the major business areas which brought in the requirement for high speed and expanded availability for substantial number of users.

On the other hand, Web 2.0 has also brought some security’s concerns. Mainly the component of client interaction with web, it opened doors to unauthorized actions in the application. In order to provide a rich user experience majority Web 2.0 sites have adopted lightweight user interface code such as asynchronous JavaScript and XML (AJAX). In the Conventional client-server models, many of calls (requests) are handled and processed on the server side. AJAX allows a higher percentage of requests to be processed on the client side. This may give malicious users many options to modify any application code running on a client machine by exploring and testing the application for vulnerabilities.

To overcome this objective, developers should consider installing an appliance at the Internet gateway, which performs real-time code inspection of traffic flowing through the corporate network. High performance and high availability appliances capable of monitoring and acting swiftly to block any suspicious web traffic are paramount. Also, it is very important that developers develop the application with security in mind. Following the coding convention, having the code reviewed, testing the application thoroughly are all part of securing the application in the web.

7 0
4 years ago
Other questions:
  • The correct syntax for accessing the length of an array named numbers is:
    15·1 answer
  • Why are video texts an example of multimedia? A. They use audio and visual elements together. B. They use one type of medium to
    13·2 answers
  • Which pillar in the cisco iot system describes embedded networks that include compact form factor switch and router cards runnin
    5·1 answer
  • hi i'm bored so.... free point and if you have any Netflix shows that are good do tell also i'm going to pick one person to give
    7·2 answers
  • A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in
    13·1 answer
  • The primary benefit to the use of overlays in animation is that animators are able to
    12·2 answers
  • Which of the following payment types require you to pay upfront?
    9·1 answer
  • 4. What is the simplest way to permanently get rid of an unwanted file?
    12·1 answer
  • What is the job of a router during the process of routing on the Internet?
    10·1 answer
  • What does l m a o actually mean?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!