Hey all! How would you write write this code?

Write a C++ program using variables and loops in order to implement the Hi-Low strategy of card counting and keep a running count. The Hi-Low strategy of card counting assigns one of three values to a card, based on its face value. The table below breaks down these values. FACE VALUE ASSIGNEDVALUE 2, 3, 4, 5, 6 +1 7, 8, 9 0 10, J, Q, K, A -1 In a typical game of Blackjack, a card counter will start with a fresh deck and a count of 0. Each time a card is played, its assigned value is added (or subtracted) from what is known as the running count. The running count rolls over from hand to hand. For instance, if the first 7 cards of a game were: Queen, Jack, 4, 6, 7, Jack, 9, then the running count would be (0) -1 -1 + 1 + 1 + 0 –1 + 0 =-1

Answers

Answer 1

The program is an illustration of loops.

Loops are used to perform repetitive actions.

The program in C++ where comments are used to explain each line, is as follows:

#include <string>

#include <iostream>

using namespace std;

int main(){

   //This declares all variables

   int n, count = 0; string k;

   //This gets input for the number of cards

   cin>>n;

   //The following is repeated n-times

   for(int i = 0;i <n;i++){

       //This gets input for the current card value

       cin>>k;

       //If the card is a digit

       if(isdigit(k[0])){

           //This checks if the card number is between 2 and 6 (inclusive)

           if(stoi(k) >= 2 && stoi(k) <= 6){

               //If yes the face value is increased by 1

               count+=1;

           }

           //This checks if the card number is 10

           else if(stoi(k) == 10){

               //If yes the face value is decreased by 1

               count-=1;

           }

       }

        //This checks if the card number is J, Q, K or A

       else if (k == "J" || k == "Q" || k == "K" || k == "A") {

           //If yes the face value is decreased by 1

           count-=1;

       }

   }

   //This prints the face value

   cout<<count;

   return 0;

}

At the end of the program, the face value is printed.

Read more about similar programs at:

https://brainly.com/question/24578223


Related Questions

DUE SOON NEED HELP FAST!!
It is 6:30pm GMT, if it is 2:00PM where are you, what is your longitude?

Answers

Answer:

From 2007 to 2016 the correct answer would've been Caracas, Venezuela. With a longitude of 66° 56' W.

Their timezone at that time was GMT-4.5, which means they'd be four and a half hours behind GMT.

As of 2021, there are no countries using that timezone for international trade and travel.

Explanation:

Had to make some assumptions. If no other context is given, then this would be the correct answer.

Giúp mình với ạ . TG làm 1 h

Answers

[tex] \huge\green{here \: is \: your \: answer}[/tex]

HELP ASAPPPP PLSSSSS!!!!!! The purpose of capillary tubes is to:


permit oxygen and nutrients to be absorbed by cells
allow blood to complete a path between arteries and veins
reverse the flow of blood
provide a means for cell wastes to enter the blood stream

Answers

Answer:

Permit oxygen and nutrients to be absorbed by cells

Explanation:

Because ,the capillaries arw the smallest of the blood vessels they act as a bridge between the two main..vessels

We know that February has either 28 or 29 days, but there is a year in the future, February will have 30 days
What exactly is this year?

Answers

Answer:

39 days is the offensive number

Explanation:

cuz calendar no have that numer

Classify the following as cross-section or time-series data: Gross sales of 200 ice cream parlors in July 2009

Answers

Answer:

let us start by stating the definitions of Time series data and Cross sectional data. TIME SERIES DATA: The data which is collected chronologically over time is known as time series data.

Explanation:

Btw brainliest me plss

Which statement is true about the storage media?

Group of answer choices

Data transfer rate of the inner tracks of a magnetic disk is higher than that of outer tracks.

Cost per bit in SSD is lower than that of a Magnetic tapes.

Cache memory is much faster than Magnetic disk storage. But it is much expensive than magnetic disks.

Magnetic disk storage is faster than SSD storage and hence it is a good candidate for a database that needs faster access time.

Answers

The statement which is true about storage media is "Cache memory is much faster than Magnetic disk storage. But it is much expensive than magnetic disks."

The cache memory is faster than both SDDs and HDDs. In mathematical terms, it is 4 time faster than SSDs and 80 times faster than HDDs. Moreover, it is more expensive then the SSDs and HDDs storage. Practically speaking, it is not good to have as much in-memory storage as persistent block storage on SSDs or HDDs.

The remaining statements are incorrect such as "Cost per bit in SSDs is lower than that of a Magnetic tapes". While truth be told the SSD cost more than the Magnetic Tapes.

Magnetic disk storage is faster than SSD storage and hence it is a good candidate for a database that needs faster access time. The statement is also incorrect as SSD are much faster than Magnetic Disk Storage.

Learn more in: https://brainly.com/question/25026748

The percentages in the table represent the performance change from the previous month. Consider the impact of each metric on customer questions.

Answers

Metrics may be described as measures used to evaluate the performance or activity of seller, employee organization and so on. They help to better understand underlying factors or patterns which may be useful in making improvement in services.

Due to the influx of customer questions which is expected to have stopped after the promotional campaign. The company is trying to know why the questions keeps coming.

Based on the questions, the company used key subjects as metric in other to Analyse and address key issues resulted to the vendor which are shipping error , discount and delivery timeline.

Therefore, metrics allow to better measure and understand specific underlying patterns associated with businesses.

Learn more :https://brainly.com/question/25114661

Given a list of twenty number count the numbers among the list

Answers

Answer:

Thank you for the points<33

What will the formula =SUM(J2:J10) do?

0 add the values in the row

O add 2 and 10 and put the sum in the column

0 add the values in cells J2 through J10

o add the values and put them in cell J2, J10​

Answers

Microsoft Office Excel formulas operate on independent values and values in a range of cells or a cell.

The formula =SUM(J2:J10) will (c) add the values in cells J2 through J10

The formula is given as:

[tex]\mathbf{=SUM(J2:J10)}[/tex]

The above formula is a SUM function, and the syntax is:

[tex]\mathbf{=SUM([cell\_range])}[/tex]

This means that, [tex]\mathbf{=SUM(J2:J10)}[/tex] will add the values in cells J2, J3 up to cell J10

Hence, the correct option that describes the formula is:

(c) add 2 and 10 and put the sum in the column

Read more about Excel formulas at:

https://brainly.com/question/1285762

Answer:

tgzjfzfjstjs tv duh GG xogxpy distinctiveness sit sctggcfcv GG cc gghhbgvvggggghhhggggbbhhhhh c tjg0gpypy6ddf%

Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. calcPyramidVolume() calls the given calcBaseArea() method in the calculation. Relevant geometry equations: Volume

Answers

Answer:

import java.io.*;

public class Main {

   public static void main(String[] args) throws IOException {

       double baseLength = 0, baseWidth = 0, pyramidHeight = 0;

       Object[] volume;

       volume = calcPyramidVolume(baseLength, baseWidth, pyramidHeight);

   }

   public static Object[] calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight) {

       double area = calcBaseArea(baseLength, baseWidth);

       double volume = baseLength * baseWidth * pyramidHeight;

       return new Object[]{volume, area};

   }

   public static double calcBaseArea(double length, double width) {

       return length * width;

   }

}

Explanation:

The problem is flawed because it is completely inefficient for one to create two separate methods to calculate the volume and the area when they can be done at once.

The second problem is that it was never specified whether to return something from the calcBaseArea method.

I assumed it required it, so it is not advisable to initiate the method as a double, but rather create it as an Object so that it can return two values: the volume and the area.

Please help. I don't know how to do this.

Answers

Answer: I need to know what the problem is tho.

Explanation: (0L0)

how does communication promotes team building​

Answers

Team members must communicate with one another in a way that encourages collaboration and mutual understanding. Trust, message clarity, and loyalty are all enhanced by effective communication. Trust and motivation are eroded by ambiguous, poorly structured communication.

Answer:

Effective communication within a team will build a common purpose among team members that will allow them to reach their goals. ... Strong group communication will create understanding and that understanding will create powerful relationships within a team.

12zener diode is connected in a series with resistance of 150ohms a load resistance of 1kiloohms is connected across the zener diode the maximum zener current should not exceed 20mA and the minimum zener current is nearly zero .calculate the operating range of the input voltage?

Answers

Answer:

please answer my question by visiting my profile please I want it urgently

A group of related classes is called a?
package. collection. attachment. archive.

Answers

archive :)))))))))))))

A(n) package is the name for a collection of linked classes. A class field that depends on the values of other class fields should not be defined. To prevent having outdated info. Thus, option A is correct.

What package is a group of related classes?

A group of related classes and interfaces are grouped under the namespace of a package. It is possible to think about packages as being similar to different computer directories.

A group of package parts is referred to as a package group. Package groups let you specify frequently connected elements as a single entity that you may associate with a rate code or a reservation.

A Bed and Breakfast package, which includes a room and breakfast service for a predetermined price, can serve as an illustration.

Therefore, make sure that just one class out of any multiple classes you define in a single Java file is public.

Learn more about package here:

https://brainly.com/question/15180292

#SPJ2

full meaning of XP in computer​

Answers

Answer → eXPerience

am i the only one that finds so much bots on peoples pages lol

Answers

Nah, I see that too lol

Can people survive without technology?
As technology advances, does technology become more or less complex?
As technology advances, do the things we make, become: more reliable? Safer? More durable? Perform better?
As technology advances, does it require more or fewer science and math applications?

Answers

Answer:

1)Nowadays no one can survive without technology.

2)more complex

3) yes

4)yes ofc

Choose the statement that is true please help me fast like right now
A: It is estimated that 50% of the estimated 100 billion stars in the Milky Way galaxy have 5 or more planets.
B: The habitable zone is where stars and planets are not threatened by either supernovas exploding or from being swallowed by black holes.
C: The radial transit method of detecting star wobble registers the amount of red shift and blue shift and blue shift detectable in the star's movement as it moves away from us or towards us.
D: Exoplanets can be observed by the reflected light they give off from their star much the same way we can observe Mars, Venus and Jupiter.

Answers

Answer:

Exoplanets can be observed by the reflected light they give off from their star much the same way we can observe Mars, Venus and Jupiter.

Explanation:

Answer

D

Explanation:

I did this exam before trust me I don't care about points

Why would you use a computer's secondary memory?
O A. To look at files created on your home computer on a public
computer
B. To run word processing software on your computer
O C. To save a slide show presentation on your computer
D. To start up your computer and perform its basic tasks

Answers

Answer:

I think B

Explanation:

Secondary storage is needed to keep programs and data long term. Secondary storage is non-volatile , long-term storage. Without secondary storage all programs and data would be lost the moment the computer is switched off.

A computer's secondary memory would be used to look at the files created on the home screen of the computer.

Option A is the correct answer.

A computer is an electronic device that is used to do various kinds of operations automatically.

Now, Secondary memory can be utilized to store the data or information which can be instantly recovered.

It is also known as backup memory. USB drives, hard disk drives, optical drives, etc. are some examples of secondary memory.

Therefore, the task of locating the files in the computer is to be done by using the computer's secondary memory. So option A is true.

Learn more about the secondary memory in the related link:

brainly.com/question/24901228

#SPJ6

2.Is having the right tool imperative to successful completion of task at hand? ​

Answers

[tex]\huge\underline\mathtt\colorbox{cyan}{Yes}[/tex]

Having the right tool is imperative to successful completion of task at hand.

Could some please answer the question in the pictures? Thank you!! I will also give your brainliest if you give me the right answers!!

Answers

Answer:

1

Explanation:

per page must have 1 body

Why did the spelling and grammar checkers in Word miss the errors highlighted in yellow?


please help, im vv confused

Answers

Answer:

I do believe that it is a grammar mistake.

Complete the following sentence by choosing from the options below. (select all that apply)
The main benefits of computers are their ability to:
save files
retrieve files
modify files
play DVDs
DONE

Answers

Answer:

Save files

Explanation:

The main benefit of a computer is to save files if there is no good storage the computer is bot complete

Saves files because if u doing work on a computer can’t save if not finished

What can you anticipate having to "give up or do" in order to attain the "things" you want?

Answers

There are many things to "give up or do" to attain the "things" you want. Some of them include giving up your time and your temporary pleasure.

Let assume you want to be successful in life, with money, family, and a good career; here are the things you can do to attain them:

Getting a good education to at least a degree level.Plan your life according to how you want it. If you want to become a medical doctor, study medicine and surgeryInvest in profitable business.Do both short-term and long-term investments.Save for rainy days.Acquire appreciable properties.Marry someone whose objective aligns with your goals in life, etc.

Hence, in this case, it is concluded that to have what you want in life, it takes a plan, dedication, and willingness to go according to the set-out plan.

Learn more here: https://brainly.com/question/13132465

The process of generating an image from a 2D or 3D model using computer programs is called ........

Answers

Answer:

endering or image synthesis is the process of generating a photorealistic or non-photorealistic image from a 2D or 3D model by means of a computer program. ... The term "rendering" is analogous to the concept of an artist's impression of a scene.

4. Identify which type of algorithmic operation each one of the following steps belongs to: a. Get a value for x from the user. b. Test to determine if x is positive. If not, tell the user that he or she has made a mistake. c. Take the cube root of x. d. Do Steps 1.1, 1.2, and 1.3 x times

Answers

Answer:

a. input/output

b. if/else statement

c. while loop

Explanation:

I don't know, sort of...

24. Describe the role of keyboard and mouse in computer? What are the fundamental similarity and differences between them? ​

Answers

Answer: They give input

Explanation: The keyboard and the mouse controll the computer, by giving inputs. Similarity - They both give inputs

Difference - They give inputs in different ways

Not Answered 17.Not Answered 18.Not Answered 19.Not Answered 20.Not Answered Question Workspace Jessica wants to purchase a new hard drive. She wants a drive that has fast access because she will use it to edit videos on her PC. She also needs a lot of storage and wants to have at least 4 TB available to save her videos. Jessica wants to keep the cost down as much as possible possible. What type of hard drive should Jessica purchase?

Answers

Answer: HDD 7200RPM

Explanation:

a solid state drive is going to be so much money especially if its 4 TB so just get a HDD 7200RPM or even better if its higher revolutions per minute......

Technology and Communications Quiz Active 1 Which of the following inventions has had the greatest impact on sound technology? A. the extension cord
B. the tape recorder
c. the telegraph
d. the microphone​

Answers

Answer:

B the tape recorder bec half century later made sonorities not only reproducible but also alterable.

evolution of management​

Answers

Answer:

Evolution of Management and Evolution of Management Science. ... Evolution of the management thought is a process that began in the earlier days of humans. It began when the man found the need to live in the groups. Then, mighty men soon organized the masses and distributed them among the groups.

Explanation:

HOPE IT HELPS

Your answer → - Evolution of management thought is a process that began in the earlier days of humans. -

Other Questions
re the two currents that flow in an X-ray tube, and how are they related? An X-ray tube is being operated with a tube potential of 30 kV. a) How may the number of X-ray photons produced be increased? b) With respect to the filament, what limits the X-ray tube output and why? c) Suggest one design change to the tube that could be made to further increase output Which of these bones is part of the axial skeleton?A. hyoid boneB. thigh boneC. wrist boneD. ankle boneE. collarbone Identify the functional groups present in each molecule. A 19-carbon compound is composed of one five-membered ring and three six-membered rings. Carbon 3 is double bonded to an oxygen and attached to carbon 2 and carbon 4. Carbon 17 is attached to an oxygen, which is attached to a hydrogen. i. hydroxyl group ii. carboxyl group iii. carbonyl group A central carbon is attached to an amine, two hydrogens, and a carbon that is double bonded to an oxygen and single bonded to an oxygen attached to a hydrogen. i. amino group ii. carboxyl group iii. amide group How does a computer do its work? Mention its working principle. what is social emotional learning in the classroom Classify the quotient as positive, negative, or zero - 25 - 5 Underline the word needs correcting and correct it:1.My mother asked me if I could help her do gardening tomorrow. ___________ plz help answer the following questions Find the EQUATION of the line through (-10,-12) and (-15,3). Use the form y=mx+b. What is the meaning of the word "strike in thispassage?hitrefuse to workremovebegin the connective tissue covering an individual muscle fiber is the need help with this plz What effect did Roman rule have on the Diaspora?Options:Strict Roman rules put severe limits on Jewish people, causing many to flee the empire.Under Roman law, Jewish people were encouraged to reject Judaism and adopt Roman ways.The rules established under the Roman Empire preserved the Jewish faith and cultural practices.Roman leaders prevented Jewish people from worshipping freely and rebuilding the Temple of Jerusalem. Which of the following is the best explanation for the fact that crushing increases the rate at which a solid dissolves in a liquid?Select one:a. The temperature of the solution is increased when the solid is crushed.b. The surface area of the solute is increased when it is crushed.c. Crushing increases the amount of solute present.d. Crushing makes stirring the solution easier. Which of the following would require more energy to heat it from 10C to 20C? a. 200 kg of water b. 200 kg of aluminum C. 100 kg of steel why are being flammable and combustible be considered to be chemical properties and not physical properties? Alani has a summer job as a lifeguard. She makes $8/h for up to 40 h each week. If she works more than 40 h, she makes 1.5 times her hourly pay, or $12/h, for each hour over 40 h. 1. How much will Alani earn if she works: a. 37 hours?Please i need this now Find the upper quartile for the data. {9, 6, 13, 8, 8, 10, 9.5, 8, 7.5, 8.5}A. 9B. 9.5C. 10D. 8.5 nathalie, customer relations manager at digital media, inc., must inform her clients of a 15 percent price increase for all services. in doing so, she should be sure to Select the correct answer.Complete the conversation:Eric: Fabin, dnde vivas hace un mes?Fabin: ____________________A. Hace un mes viva en Puebla.B. Hace dos meses viva en Puebla.C. Ahora vivo en Puebla.D. Hace un ao viva en Puebla.