In this lab, you add a loop and the statements that make up the loop body to a C++ program that is provided. When completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. Your loop should execute until the user enters the character X instead of L for left-handed or R for right-handed.

The inputs for this program are as follows: R, R, R, L, L, L, R, L, R, R, L, X

Variables have been declared for you, and the input and output statements have been written.

Instructions
Ensure the source code file named LeftOrRight.cpp is open in the code editor.

Write a loop and a loop body that allows you to calculate a total of left-handed and right-handed people in your class.

Execute the program by clicking the Run button and using the data listed above and verify that the output is correct.

// LeftOrRight.cpp - This program calculates the total number of left-handed and right-handed
// students in a class.
// Input: L for left-handed; R for right handed; X to quit.
// Output: Prints the number of left-handed students and the number of right-handed students.

#include
#include
using namespace std;
int main()
{
string leftOrRight = ""; // L or R for one student.
int rightTotal = 0; // Number of right-handed students.
int leftTotal = 0; // Number of left-handed students.

// This is the work done in the housekeeping() function
cout << "Enter an L if you are left-handed, a R if you are right-handed or X to quit: ";
cin >> leftOrRight;

// This is the work done in the detailLoop() function
// Write your loop here.


// This is the work done in the endOfJob() function
// Output number of left or right-handed students.
cout << "Number of left-handed students: " << leftTotal << endl;
cout << "Number of right-handed students: " << rightTotal << endl;

return 0;
}

Answers

Answer 1

Answer:

#include <iostream>

#include <string>

//  R, R, R,  L, L, L,  R,  L,  R, R,  L,  X  ==>  6R 5L  X

void getLeftOrRight(std::string &l_or_r, int &total_l, int &total_r) {

 // notice how the above line matches:   getLeftOrRight(leftOrRight, leftTotal, rightTotal);

 // the values provided from the loop are given nicknames for this function getLeftOrRight()

 if (l_or_r == "L") {  // left-handed

   total_l++;

 } else if (l_or_r == "R") {  // right-handed

   total_r++;

 } else {  // quit

   // option must be "X" (quit), so we do nothing!

 }

 return;  // we return nothing, which is why the function is void

}

int main() {

 std::string leftOrRight = "";  // L or R for one student.

 int rightTotal = 0;            // Number of right-handed students.

 int leftTotal  = 0;            // Number of left-handed students.

 while (leftOrRight != "X") {  // whilst the user hasn't chosen "X" to quit

   std::cout << "Pick an option:" << std::endl;

   std::cout << "\t[L] left-handed\n\t[R] right-handed\n\t[X] quit\n\t--> ";

   std::cin  >> leftOrRight;  // store the user's option in the variable

   getLeftOrRight(leftOrRight, leftTotal, rightTotal);  // call a function, and provide it the 3 arguments

 }

 

 std::cout << "Number of left-handed students:  " << leftTotal  << std::endl;

 std::cout << "Number of right-handed students: " << rightTotal << std::endl;

 

 return 0;

}

Explanation:

This is my take on the question! I had no idea what was meant by the housekeeping(), detailLoop(), endOfJob() functions provided in their source code.

What my code does should be pretty explanatory via the comments and variable names within it — but feel free to make a comment to ask for more info! I've attached a screenshot of my code because I think it's easier to read when it's syntax highlighted with colors.

In This Lab, You Add A Loop And The Statements That Make Up The Loop Body To A C++ Program That Is Provided.
Answer 2

In this code, the while loop continues to execute as long as the user enters something other than 'X'.

You need to write a loop that repeatedly takes input from the user and updates the leftTotal and rightTotal variables based on the input until the user enters 'X' to quit.

Here's the completed code:

#include <iostream>

using namespace std;

int main()

{

   string leftOrRight = ""; // L or R for one student.

   int rightTotal = 0; // Number of right-handed students.

   int leftTotal = 0; // Number of left-handed students.

   cout << "Enter an L if you are left-handed, a R if you are right-handed or X to quit: ";

   cin >> leftOrRight;

   // Write your loop here.

   while (leftOrRight != "X") {

       if (leftOrRight == "L") {

           leftTotal++;

       } else if (leftOrRight == "R") {

           rightTotal++;

       }

       cout << "Enter an L if you are left-handed, a R if you are right-handed or X to quit: ";

       cin >> leftOrRight;

   }

   cout << "Number of left-handed students: " << leftTotal << endl;

   cout << "Number of right-handed students: " << rightTotal << endl;

   return 0;

}

In this code, the while loop continues to execute as long as the user enters something other than 'X'.

Inside the loop, the input is checked for either 'L' or 'R', and the appropriate total variable is incremented accordingly.

The loop then prompts the user for input again until the user decides to quit by entering 'X'.

Finally, the code displays the total number of left-handed and right-handed students.

Learn more about C++ program click;

https://brainly.com/question/33180199

#SPJ3


Related Questions

Sarah has to draw a shape that looks like a revolving circle for her class project in technical drawing. What should Sarah draw?

A cylinder
B. cone
C. sphere
D. ellipsoid
E. prism

Answers

The drawing that Sarah should draw so that it looks like a revolving circle for her class project in technical drawing is a sphere.

What is a sphere?

A sphere is a three-dimensional equivalent of a two-dimensional circle. A sphere is a collection of points in three-dimensional space that are all the same distance r from a particular point.

Despite the fact at which angle you look, a sphere always looks like a circle. This property of the sphere can be used by Sarah. And hence, the drawing that Sarah should draw so that it looks like a revolving circle for her class project in technical drawing is a sphere.

Learn more about Sphere:

https://brainly.com/question/11374994

#SPJ1

How to write a C++ program that lets the user guess if a randomly generated integer is even or odd then the computer lets them know if they are correct or incorrect

Answers

#include <iostream>

using namespace std;

int main() {

 string input;

 string rand_type;

int number=rand()%100+1; //number between 1 and 100

if ( number % 2 == 0)

   rand_type= "even";

 else

  rand_type="odd";

 cout << "your guess: ";

 cin >> input;

 if ( input== rand_type)

   cout << "correct.\n";

else

   cout << "incorrect.\n";

 return 0;

}

what does it mean by an operating system plays the 'middle person's role between the hardware and the application software?​

Answers

Answer:

The hard ware holds the operating system, and the operating controls the application software.

Explanation:

An information system can enhance core competencies by

Answers

Answer:

An information system can enhance core competencies by: encouraging the sharing of knowledge across business units.

Explanation:

Hope this helps you ! please mark me brainless

The probability of event A occurring is 10/10. The probability of event B occurring is 0/10. What is the entropy of this system? Please show work.

Answers

The events A and B are the outcomes of the probabilities in the system

The entropy of the system is 0

How to determine the entropy?

The probabilities are given as:

P(A) = 10/10

P(B) = 0/10

The entropy is calculated using:

[tex]H(x) = -\sum \limits^{n}_{i = 1} p_i * \log_2(p_i)[/tex]

So, we have

[tex]H(x) = -10/10 * \log_2(10/10) - 0/10 * \log_2(0/10)[/tex]

Evaluate the products

[tex]H(x) = -\log_2(10/10) - 0[/tex]

Evaluate the sum

[tex]H(x) = -\log_2(10/10)[/tex]

Evaluate the quotient

[tex]H(x) =- \log_2(1)[/tex]

Express 1 as 2^0

[tex]H(x) =- \log_2(2^0)[/tex]

Apply the power rule of logarithm

[tex]H(x) =- 0\log_2(2)[/tex]

Evaluate the product

H(x) =0

Hence, the entropy of the system is 0

Read more about probability at:

https://brainly.com/question/25870256

explain the pros and cons of touchscreen, non-touchscreen, and hybrid devices:

Answers

Answer:The customer reviews of touchscreen laptops like the Lenovo Ideapad 3 Laptop show that it allows faster navigation. It is based on touch-screen technology that improves the functionality of your computer. This allows you to perform tasks that are difficult to do on a traditional laptop. It is easy to use and you can operate it without requiring any additional attachment.

Explanation:

A touch screen laptop is easier to use, fun to navigate, and comes in sleeker models. The non-touch laptop is a traditional laptop variant that takes input from the built-in touchpad and keyboard. Both the laptops are similar in many aspects. At first, the touchscreen feature was only available in high-end business laptops, but now you can buy a touch screen laptop at an affordable price. In this blog, we compare Touch Screen Vs Non-Touch Laptops and help you understand their advantages and disadvantages.

A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowdsourcing?


A mobile application and collar that uses GPS technology to determine the pet’s location and transmits the location when the owner refreshes the application

A mobile application and collar that uses wireless technology to determine whether the pet is within 100 feet of the owner's phone and transmits a message to the owner when the pet is nearby

A mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application

A mobile application that transmits a message to all users any time a lost pet is returned to its owner

Answers

Crowdsourcing  is used by mobile application that allows users to report the location of a pet that appears to be lost.

What is a mobile application?

A mobile application is known to be a kind of computer app or program that has been made to handle or run itself on a mobile device e.g. phone,  etc.

Conclusively, the option that best describes a system that uses crowdsourcing is the mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application and thus everyone can help to look for it.

Learn more about mobile application  from

https://brainly.com/question/9477543

#SPJ1

What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign keys in the table to secure table data to secure the foreign keys in the table

Answers

Answer:

A. To uniquely identify each record in the table

brainliest pls?

Customized packages are a type of application software true or false

Answers

Answer:

donno, but i guess its true

Explanation:

u dont need a external hardware or plug something to have them, u can just install

Which statement describes a difference between front-end and back-end databases?

Answers

Answer:

So a statement could be the front-end is what we see and the back-end is what we don't see, the behind the scenes. Like a play, we see the characters and them acting out a story but we dont see who is doing the lights, playing the music, fixing the costumes and makeup etc..

Explanation:

The term front-end means interface while the term back-end means server. So imagine you go on your social media app, what you can see like your friends list and your account and the pictures you post, who liked the pictures and all of that is called the front-end and is what you as a user can interact with; front-end development is the programming that focuses on the visual aspect and elements of a website or app that a user will interact with its called in other words the client side. Meanwhile, back-end development focusing on the side of a website users can't see otherwise known as the server side, its what code the site uses and what it does with data and how a server runs and interacts with a user on whatever device surface they're using.

Answer:

B is the answer

Explanation:

Some one in the first response said it not me but he just saved me from a C

What is the purpose of a host operating system?

It allows one guest to access software at a time.
It controls who can access software.
It stands between the guest OS and the hardware.
It is used to monitor network traffic.

Answers

Answer:

It controls who can access software.

Explanation:

How do I code strings in java

Answers

Answer: Below

Explanation:

Prescribe variable as string, and anything assigned to it will be a string.
Example:
String java_string;
java_string = "Hello world";

Which of the following best describes the impact of Creative Commons?

Creative Commons gives creators of digital content the ability to indicate how their works can be legally used and distributed, enabling broad access to digital information.

Creative Commons gives Internet users the right to legally use and distribute any previously copyrighted work, enabling broad access to digital information.

Create Commons provides lossless transmission of messages, enabling reliable distribution of digital information.

Creative Commons provides private transmission of messages, enabling secure distribution of digital information.

Answers

Answer:

it’s just a screenie hope it helps

What kind of internal factors influence the process of business enterprise

Answers

Answer:

The three main internal factors are:

Human resources

Finance

Current or modern technology

Explanation:

Financial resources like funding, investment opportunities, and sources of income.

Physical resources like the company's location, equipment, and facilities.

Human resources like employees, target audiences, and volunteers.

Which CPT icon should be considered when entering CPT codes into a spreadsheet for numerical sorting

Answers

Answer:

##

Explanation:

Hashtag (#) symbols identifies codes out of numerical sequence. These codes are listed in Appendix N. Star symbols identify codes that, when appended by modifier 95, can be used to report telemedicine services.

The Greater Than sign (>) is an example of
operator.

Answers

Answer:

logical

Explanation:

the greater than sign (>) is an example of logical operator.

A > sign asks if the first value is greater than the second value. That is, is the value or expression to the left of the > sign greater than the value or expression to the right side? For example, the statement (A > B) is true if A is greater than B

https://brainly.in/question/6901230

The question is provided in the image below.

Answers

Answer: b

Explanation:

what is e-bidding? explain in 3 lines​

Answers

Answer:

An ‘‘‘electronic bidding system ‘‘‘ is an electronic bidding event according to defined negotiation rules. A buyer and two or more suppliers take part in this online event.

Calvin is creating a 3D shell of a turtle. He is creating a sculpted, intricate design for the pattern he wants on the shell, but wants it to tile across the surface of the shell. What tool can he use to do this?

A.
Dynamic Topology

B.
Symmetry

C.
Remesh

D.
Masking
(This is a question from edmentum's 3d modeling class)

Answers

A is right I did this

Discusse five advantages of utilising DBMS over a file based system

Answers

Answer:

Data concurrency – ...

Data searching – ...

Data integrity – ...

System crashing – ...

Data security –

Explanation:

You are creating a game in which players lose their silver if they are robbed by pirates. Which line of code would remove the silver from the list of treasures? O A. treasures.pop("silver") O B. treasures.remove("silver") OC. treasures.pop["silver"] O D. treasures.remove["silver"]​

Answers

The  line of code that would remove the silver from the list of treasures is treasures.remove("silver").

What is needed to create a game?

In the development of a game, it's vital to know what is needed in the creation of that  game. Especially in the area of inputs such as coding.

Conclusively, The  line of code that would remove the silver from the list of treasures is treasures.remove("silver"). as it contains the information on the silver removal.

Learn more about game from

https://brainly.com/question/857914

#SPJ1

What is installing?
the process of putting new software on a computer
the process of replacing an older version of software with a newer version
O the process of limiting who is allowed to access your information
O the process of programming a language to use on a web page

Answers

The process of putting new software on a computer

D is the answer I got it right

Select the correct text in the passage.
Which of the following statements is true with regards to satellite Internet access?
It is cheap.
It is the slowest internet access technology.
It can be used in rural and remote areas.
It requires direct line-of-sight to work.
It requires major installation of new infrastructure.
It covers a large geographical area.

Answers

Not cheap

Actually very fast

Works anywhere that you can see the sky (e.g. not 100m underground)

Requires direct line-of-sight

Requires new infrastructure in space (satellites), but small dishes for customers on Earth (so i’d say no)

Yes, satellites of any kind cover a large geographical area

100 PTS! The first network was called:

A. the Internet
B. ARPANET
C. the network
D. networking

Answers

Answer:

B

Explanation:

.....................

Answer: B. ARPANET

Explanation:in full Advanced Research Projects Agency Network, experimental computer network that was the forerunner of the Internet.

Identify the calculation performed by the following code.
function calcArea(length, width) {

var rectArea = length*width;

return rectArea;

}

var x = 8;

var y = 6;

calcArea(x, y);

a.
48
b.
96
c.
28
d.
56

Answers

Answer:

48

Explanation:

The function returns length * width

In the function call, the values are legnth: 8 and width: 6 this means the function is returns 8 * 6 wich is 48.

y library> COMP 107: Web Page Design home > 49. LAB Auto loan (CSS) Students: Section 4.9 is a part of 1 assignment Week 7 LAB: Auto Loan (CSS) 4.9 LAB: Auto loan (CSS) Create an external stylesheet so the provided HTML produces the following web page Comparison of Dealer Incentives and Loan Offers Purchase Offer 1 Purchase Offer 2 am Cost Purchase price $33.500 Purchase price Cash incentive rebate $0 Cash incentivebate Loan term (months) 48 Loan term (mores Annual percentage rate (APR) 32 Annual porcentago (APS) Monthly payment 572530 Monthly payment search D O 方 E

Answers

This lab requires that you create an external stylesheet to style the web page. You should include elements such as font size, font family, font weight, font style, font color, background color, background image.

What is the elements?

Elements are the basic substances that make up all matter in the universe. They are the fundamental building blocks of all matter and are made up of atoms. There are currently 118 known elements, including hydrogen, oxygen, carbon, nitrogen, and iron. Elements are organized on the periodic table according to their chemical and atomic properties. They are classified by their atomic number, number of protons, and chemical properties. When elements combine, they form compounds, which can have properties that are different from the elements that make them up.

To learn more about elements

https://brainly.com/question/29338740

#SPJ1

Thabo has a small barber shop and he uses Microsoft applications to keep track of his stock and to create posters for advertising his barber shop. Thabo is worried about customers coming to the barber shop during the pandemic, as there might be difficulties adhering to social distancing rules and controlling overcrowding. You have informed Thabo about a great information system that could be used by his customers to place book for specific time slots as well as communicating with Thabo. Thabo needs some convincing about implementing a computerised information system.

Q.1.1 In your quest to convince discuss at least five benefits of implementing an information system in Thabo’s business.

Q.1.2 Thabo understand the benefits of implementing an Information system in his business. However, Thabo requires more information regarding what entails a successful information system.

Discuss, using appropriate examples, the components of an Information system and their role applicable to Thabo’s barber shop

Answers

An information system is crucial to the success of a business. Itemized below are five benefits of operating an information system in a business.

What are the benefits of an Information System?

Information systems are important because:

They help to increase and enhance operational efficiencies such as accounting, sales, inventory, and HR operations.They help to minimize costs. As the business makes more and more informed decisions, its costs will drop.It enhances customer service. Information about customers helps the business to tailor its services to the requirements of each customer.Information system helps the decision-makers in the business to make better and more informed decisions.Information systems help to ensure business continuity.

What are the requirements for creating an information system?

An information system requires the following:

Hardware for the computer workstation and addendumsSoftwareA network communication amongst the computers and hardwarea map of the company's processes and the people responsible for such processesA procedural manual.Existing data from the business.

For the barber's shop, for example, some of the components of the information system he must put in place are:

A workstation that collects information about:

ClientsDetails of SalesExpensesCompliance dates and records etc.

Learn more about Information Systems at:

https://brainly.com/question/25226643

fghfghgfhgfhgfhfghgfhgfhfghgfhgfh

Answers

Answer:

Stay safe, stay healthy and blessed.

Have a good day !

Thank you

Answer:

are you okay

Explanation:

just want to know

Which of the following is an example of how high student loan debt can
impact a person's life decisions?

Answers

Student loan debt is the debt owed by the students to a financial institution. The person has to choose public transportation over a personal vehicle as they cannot afford a downpayment.

What is the impact of the student loan?

Students loan are the debt that is incurred by the students for educational purposes and affects the quality of the life of a person as they need to save money to pay the debt.

The student owing money cannot afford to buy their vehicle because of the downpayment and will choose to use public transportation over buying a car to save money.

Therefore, high student loans will lead to the use of public transportation instead of buying cars.

Learn more about loans here:

https://brainly.com/question/27205887

#SPJ1

advantages and disadvantages of memory mapped I/O?

Answers

Explanation:

Advantages : The advantage of memory mapped I/O is that all instructions and addressing modes can be used for I/O access. This makes programming easier. When Direct I/O is supported, many microprocessors provide limited instructions and addressing modes for I/O access.

Dis Advantages : But there are also disadvantages: An I/O error on a memory-mapped file cannot be caught and dealt with by SQLite. Instead, the I/O error causes a signal which, if not caught by the application, results in a program crash.
Other Questions
Is it ever ok for one country to take control of another country? If so, explain the reasons. If it isnt then explain why it is not. What should be included in a financial plan to protect assets?a. how much money you will make3 b. how much money you will have in savingsC.how much money you will investd. how much insurance you will carryPlease select the best answer from the choices providedOAOBO COD Writing Situation: The park in your area has only one tennis court. It is always crowded and one has to wait at least two hours before getting a chance to play.Writing Task: Write a persuasive letter to your mayor requesting more tennis courts in your area. In your letter, be sure to describe the situation and explain the reasons why you need more tennis courts.Hi pls help Graph the line Y minus 5X equals -2 Which of the following is the best definition of a division paragraph? A. It is a paragraph that divides objects into different parts.B. It is a paragraph that is divided into topic and body.C. It is a paragraph that divides separate items into specific groupsbased on some consistent principle. D. It is a paragraph that uses hateful language to divide peopleinstead of bring them together. What kept the different ethnic groups of Yugoslavia together as one nation?forcewarreligionlaws Read the excerpt from "The Case for Shelter Animals," and observe the boldfaced evidence to support the main argument.What does that mean for the dogs and cats who are not adopted? Sadly, it means that they are at risk of being put down. So, in a very real sense, adopting a dog or a cat from a shelter is literally an act that can save that animals life. This is why adopting a shelter animal is also known as rescuing it.The main argument is that adopting a pet is what is most humane for animals.Which answer best uses the evidence to evaluate the main argument?A.The argument is effective; the evidence explains what happens to animals that are not adopted.B.The argument is effective; the evidence presents what life is like for shelter animals.C.The argument is ineffective; the evidence explains the difficulty of running a shelter.D.The argument is ineffective; the evidence does not provide valid reasoning. Necesito 4 oraciones con hoces y 4 con oses mean of 12, 2, 64, 0, 48, 4, 6, 80 ________ is the conflict-handling style in which both parties give up something to gain something. Find the rule and solve for nPlease help me I need this now. PLS ANSWER QUICK! What are 3 possible misconceptions someone might have about life during the American Civil War? 3. Why did some Americans disapprove of the Medicare program created by the Social Security Act of 1965?a Medicare took the place of regular Social Security for people 65 and older.b Some people did not like the fact that only segregated medical offices could receive Medicare payments.c Medicare did not provide all the health care people 65 and older needed.d Some people thought that Medicare gave the federal government too much power over health care. Rectangle ABCD is a dilation of rectangle ABCD.What is the scale factor?Enter your answer in the box. What does occupations mean? A written memo is usually more ____ than most interoffice communications.A. formal, lengthy, and officialB.formal and officialC. informal D. officialE. lengthyF. formal A Spanish test has 30 questions. A student answers 80% correctly.How many questions does the student answer correctly?Enter your answer in the box. questions Complete the following table by indicating if each attribute characterizes a competitive market, a monopolistically competitive market, both, or neither. check all that apply. this is the question What is the theoretical probability ofrandomly picking a triangle from the shapesbelow?