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

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 Program

#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;

}

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1


Related Questions

(7) Accept a 4-digit number from a user. Your task is to create a simple encrypted corresponding value
of this number. First separate each number into its individual digits. For each individual digit, if the
individual digit is greater than or equal to 5, subtract that value from 9. Output the new value (in its
individual digits) which would now represent the encrypted corresponding value. For example, if the
user entered 5678, the encrypted corresponding value would be 4 2 3 1. (Required: IPO chart,
Pseudocode, C-program and Python)

Answers

Using the knowledge in computational language in python it is possible to write a code that create a simple encrypted corresponding value

of this number.

Writting in the C code:

#include<stdio.h>

int main()

{

   int num,r,rev=0;

   scanf("%d",&num);

   while(num!=0)

   {

       r=num%10;

       rev=rev*10+r;

       num=num/10;

   }

   while(rev!=0)

   {

       r=rev%10;

       if(r>=5)

       {

           r=9-r;

       }

       printf("%d ",r);

       rev=rev/10;

   }

   return 0;

}

Writting in python code:

num=int(input("Enter number:"))

rev=int(str(num)[::-1])

while rev!=0:

   r=rev%10

   if r>=5:

       r=9-r

   print(r,end=" ")

   rev=rev//10

See more about python at brainly.com/question/12975450

#SPJ1

why is this happening and how do I fix it?

Answers

Answer:

who is known as prophet of the computer?why?

Which of the following protects intellectual property?
A. copyright
B. trademark
C. putting on a play
D. writing a novel

Answers

Answer:

A). Copyright

the next questions answer is

C). For the life of the author plus seventy years.

Explanation:

I just did the Assignment on EDGE2022 and it's 200% correct!

Also, heart and rate if you found this answer helpful!! :) (P.S It makes me feel good to know I helped someone today!!)

Wendy Patel is entering college and plans to take the necessary classes to obtain a degree in architecture. Research the programs and apps that Wendy might use in her degree program and recommend a computer with sufficient hardware specifications to adequately support her through the degree program. Provide a link to the computer you locate and justify why you feel the computer will best meet her needs. Why did you choose the central processing unit? Why did you choose the amount of RAM? Why did you choose the storage device?

Answers

Some of the programs and apps that Wendy might use in her degree program of architecture are:

AutoCAD Mobile AppMorpholio Trace Pro.ARki. ArchiSnapper 5.MagicPlan.Shapr3D

A recommended computer that Wendy Patel can use in her university study of obtaining a degree in architecture is an ASUS ZenBook S Ultra Slim Flip Laptop.

The RAM is 16GB RAM and the CPU is an 11th Generation Core i7-1165G7 chip that would help her navigate through her design projects.

What is Architecture?

This refers to the process of designing and constructing buildings with the aid of software.

Hence, we can see that Some of the programs and apps that Wendy might use in her degree program of architecture are:

AutoCAD Mobile AppMorpholio Trace Pro.ARki. ArchiSnapper 5.MagicPlan.Shapr3D

A recommended computer that Wendy Patel can use in her university study of obtaining a degree in architecture is an ASUS ZenBook S Ultra Slim Flip Laptop.

The RAM is 16GB RAM and the CPU is an 11th Generation Core i7-1165G7 chip that would help her navigate through her design projects.

Read more about architecture here:

https://brainly.com/question/9760486

#SPJ1

Amed is utilizing a feature that will use two tables. The first table contains a primary key matched to a foreign key in the second table. The query results will include all entries from the first table. Which feature is he using?

left outer join
right outer join
self join
inner join

Answers

Answer:

left outer join

Explanation:

Find the following measures of central tendency for the given set of data. {1, 3, 9, 11, 2}

Answers

Answer:

(1+3+9+11+2)/5=26/5=5.2

Help please‍♀️

What is the name for the different RULES that are specific to each programming
language? These languages use commands and logic statements to make the
computer accomplish its intended purpose.

Software

Programs

Syntax

Binary

Answers

Answer:

syntax

Explanation:

Each programming language follows a specific set of “grammar” rules called syntax; Every programming language is designed to serve a specific purpose, i.e. to allow you to build websites, do data analysis, or create desktop software etc.

Im in 7th grade :D

Classify the following devices as input or ourput. Draw a line from the picture to the correct name of the device.​

Answers

Answer:

input: keyboard + mouse

output: monitor + printer

MC Qu. 05 The most common way to access the Internet i...
The most common way to access the Internet is through

Answers

Answer: The most common way to access the internet is through Mobile phone

Provide a code example for a shape with no outline. What can you do to ensure this is the
outline that will be used?

Answers

A code example for a shape with no outline or one that its borders has been removed has been given below:

The Code

Dim rngShape As InlineShape

For Each rngShape In ActiveDocument.InlineShapes

   With rngShape.Range.Borders

       .OutsideLineStyle = wdLineStyleSingle

       .OutsideColorIndex = wdPink

      .OutsideLineWidth = wdLineWidth300pt

   End With

Next rngShape

Read more about shapes and borders here:

https://brainly.com/question/14400252

#SPJ1

characteristics of third generation of computer​

Answers

Answer:

1. Use of Integrated Circuits (IC) instead of transistors.

2. Use of Semi-conductor memory.

3. Small size than previous generation computers.

4. Use of magnetic storage devices.

5. Improved faster operations and more dependable output.

6. Use of mini computers.

7. Use of monitors and line printers.

8. What should one do in order to gain the most benefit from the concept of learning styles?
a. Be rigid
b. Be persistent
c. Be imaginative
d. Stay flexible

D stay flexible

Answers

The thing that a person should do in order to gain the most benefit from the concept of learning styles is option D: stay flexible.

What does learning styles mean?

Learning styles can be categorized, identified, and described in a variety of ways. They are, in general, broad patterns that give teaching and learning direction.

Another way to think of learning style is as a set or a given group of elements, actions, as well as attitudes that support a person's learning in a specific circumstance.

Therefore, based on the above, The thing that a person should do in order to gain the most benefit from the concept of learning styles is option D: stay flexible.

Learn more about learning styles from

https://brainly.com/question/3274282
#SPJ1

What was the largest processor used in the 1990s?
(1 point)
O 16-bit
O 32-bit
O 64-bit
O 128-bit

Answers

Answer: 64 bit

Explanation: 128 bit not used at that time

Besides UEFI, what other type of firmware might you see on a motherboard?

Answers

Besides UEFI, the other type of firmware that you might see on a motherboard is BIOS.

What is a computer hardware?

A computer hardware can be defined as a physical component of an information technology (IT) or computer system that can be seen and touched.

The hardware components of a computer.

Some examples of the hardware components of a computer system and these include:

MonitorMouseRandom access memory (RAM).Read only memory (ROM).Central processing unit (CPU)KeyboardMotherboard BIOS chip

In Computer technology, the two types of of firmware that you might see on a motherboard are Basic Output-Input system (BIOS) and Unified Extensible Firmware Interface (UEFI).

Read more on motherboard BIOS chip here: brainly.com/question/17373331

#SPJ1

Write the contribution of baise pascal and dr herman hollerith in the histroy of computer

Answers

Answer:Computers truly became a revolutionized invention during the last part of the 20th century. They have already helped win wars, solve seemingly insoluble problems, saved lives and launched us into space. Their history spans more than 2500 years to the creation of the abacus. This resource provides a brief history of computers.The Pascaline

In 1642, an eighteen year old French scientist, writer and philosopher, Blaise Pascal (1623–1662), invented the very first mechanical calculator. It was named the Pascaline.

It had been created as an aid for Pascal’s father, who was a tax collector. Pascal built fifty of these gear driven calculating machines and couldn’t manage to sell many due to their expensive cost.

Explanation:

What is the relationship between the ask phase of the data analysis process and the plan phase of the data life cycle?

Answers

Answer:

The data analytic lifecycle is intended for use with data science initiatives and Big Data issues. The cycle reflects a real project by being iterative.

Karen has a discrete analog clock in the shape of a circle. Two hands rotate around the center of the circle, indicating hours and minutes. The clock has 60 marks placed around its perimeter, with the distance between consecutive marks being constant.
The minute hand moves from its current mark to the next exactly once every minute. The hour hand moves from its current mark to the next exactly once every 12 minutes, so it advances five marks each hour. We consider that both hands move discretely and instantly, which means they are always positioned exactly over one of the marks and never in between marks.
At midnight both hands reach simultaneously the top mark, which indicates Zero hours Zero minutes. After exactly 12 hours or 720 minutes, both hands reach the same position again, and this process is repeated over and over again. Note that when the minute hand moves, the hour hand may not move; however, when the hour hand moves, the minute hand also moves.
Karen likes geometry, and she likes to measure the minimum angle between the two hands of the clock at different times of the day. She has been writing some measures down, she noticed that some angles were repeated while some others never appeared. For instance, Karen noticed that both at three o'clock and at nine o'clock the minimum angle between the two ands is 90 degrees, while an angle of 65 degrees not appear in the list.
Karen decided to verify, for any integer number between 0 and 180, if there exists at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees. In this lab you will code a program to help Karen to answer this question and display which hour meet the angle.
NOTE: Your program needs to perform operation(s) and use control statements to solve the problem. Solutions that imply to create a switch-case or if-else for all 181 (or 91) possible values (Hard Coding) automatically will be scored with 0.
Input:
The program gets as input an integer value A s.t. (0<= A <= 180), which represents the angle to be verified. Validate that this input is within the valid range.
Output:
If there exist at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees, then display how many hours met the specified angle and those hours in ascending order (24-hour military time clock). Otherwise display "There is no hour where the hands are A degrees apart".

Answers

Answer:

no idea

Explanation:

but I want you to know, you are a great person


What statement is an example of the specific requirements of smart goal?

Answers

Answer:

Specific: I’m going to write a 60,000-word sci-fi novel.

Measurable: I will finish writing 60,000 words in 6 months.

Achievable: I will write 2,500 words per week.

Relevant: I’ve always dreamed of becoming a professional writer.

Time-bound: I will start writing tomorrow on January 1st, and finish June 30th.

Explanation:

I did this mark brainiest

"As a busy professional and avid book lover, I want to be able to reserve books in advance, so that I can pick them up based on my schedule.” (ux)

What component of the user story addresses the persona’s goal to access books they want to read when they arrive at the library?


Demographic

Benefit

Action

Role

Answers

Answer:

The answer is benefit

that it

To tell an audience a story about a data set, it is best to use a _____________.

A) memo
B) graph
C) dashboard
D) report

Answers

Your answer should be (B
it is best to use a graph.

4.15 LAB: Convert to reverse binary
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in reverse binary. For an integer x, the algorithm is:

As long as x is greater than 0
Output x % 2 (remainder is either 0 or 1)
x = x / 2

Please help me!!

Answers

A program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in reverse binary is

num = int(input())

while num > 0:

   y =(num % 2)

   print(y, end='')

   num = (num//2)

print()

num = int(input("Enter a number"))

string = ""

while num > 0:

   y =str(num % 2)

   string+=y

   num = (num//2)

reverse=string[::-1]

print(reverse)

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1

What can a programmer expect when writing a modular program for a game

Answers

Answer:

That it's gonna be hard.

Marc is a gamer and is in the market for a new computer to support a lot of graphics. He needs to find a computer with a high amount of RAM, because the higher the RAM, the faster it will function.

A: True
B: False

Answers

Since Marc is a gamer and is in the market for a new computer to support a lot of graphics. He needs to find a computer with a high amount of RAM, because the higher the RAM, the faster it will function is option A: true statement.

What is the statement of the higher the RAM, the faster it will function about?

In regards to computing, when the RAM is known to be faster, one can say also that  the faster will be the computer  the processing speed.

Note that when there is a faster RAM, a person or a computer user can be able to increase the speed through which the computer memory moves information to other parts of the system.

This implies that  there is a fast processor and thus an equally faster means of talking to the other areas of the system, making the computer to be much more good.

Therefore, Since Marc is a gamer and is in the market for a new computer to support a lot of graphics. He needs to find a computer with a high amount of RAM, because the higher the RAM, the faster it will function is option A: true statement.

Learn more about RAM from

https://brainly.com/question/13196228

#SPJ1

a prospect calls a sales rep at a firm as teh prospect listend to her pitch he keeps pushing back that the price is higher than most. What should the rep do?

Answers

Since there is a prospect calls a sales rep at a firm as the prospect listened to her pitch he keeps pushing back that the price is higher than most. the thing that the rep can do is option d: Ask him to set aside price for now to see if the services are a good fit.

How to be a sales rep

A sales rep is known to be any body that is a person who is said to function as the seller of products or services for a given firm.

Note that they are often in seen in a specific field or area. Rep is a wood that is the short form for representative. The term sales representative are people who often works for (stand) for a company but the salesperson is one that can also be selling their own special products.

There are different kinds of calls and there are ways to handle such calls. Based on the scenario above, Since there is a prospect calls a sales rep at a firm as the prospect listened to her pitch he keeps pushing back that the price is higher than most. the thing that the rep can do is option d: Ask him to set aside price for now to see if the services are a good fit.

Learn more about sales rep  from

https://brainly.com/question/28410390

#SPJ1

A prospect calls a sales rep at a consulting firm. As the prospect listens to her sales pitch, he keeps pushing back that the price is higher than most. What should the rep do? a. Agree that her company's services are expensive but promise that they'll solve his problems b. Ask him to hold and check with her supervisor if she can offer a discount a c. Ask him what price he would consider fair and reasonable d. Ask him to set aside price for now to see if the services are a good fit e. Point out that if he did his research, he knows that her company's services are better than those of competitors

1. How are you going to apply proper selection of tools in your daily life?

2. Do you think knowing each tool used for computer systems servicing will be a big help for you in the future?

3. How important for a student like you to know the scope of work you should properly accomplish?​

Answers

Answer:

PROPER TOOLS SELECTION 2. Tool •Is a handheld device that aids in accomplishing a task •Range from a traditional metal cutting part of a machine to an element of a computer program that activates and controls a particular function. 3. Preparing for the task to be

Explanation:

Difference between us 2.0
and 3.0 flash drive

Answers

USB 2.0 offers a transfer rate of about 480 Mbps, whereas USB 3.0 offers a transfer rate of about 4,800 Mbps

Describe the differences between power and authority

Answers

Answer:

power is authjority

Explanation:

HELP ME OUT PLEASE!!!!!!!

________ this design element is used to indicate hierarchy.

A) Line
B) Decorative
C) Shade
D) Balance​

Answers

Answer:

Line

Explanation:

Because they have a big line thanks for the points please help me with my problem is in my profile

Answer:

Line

Explanation: Because they have a big line thanks for the points please help me with my problem is in my profile

What are Thear Platforms?

Answers

A computing platform or digital platform is an environment in which a piece of software is executed. It may be the hardware or the operating system, even a web browser and associated application programming interfaces, or other underlying software, as long as the program code is executed with it.

Answer:

A conglomerate technology company.

Explanation:

Thear Platforms is commonly known as Thear. It is a conglomerate technology company with different platforms.

Some platforms by Thear are as follows

1. Thear Blog (Blogging Site)

2. Thear Library (Educational Site)

3. Thear Updates (News Site)

and many others....

You may access these at https://thear.me/

Is Qatar a highly restricted internet censored country? What is the best free VPN for Qatar?

Answers

Answer: Yes.

Explanation:

Qatar is a highly restricted country in terms of the internet freedom. It keeps blocking different websites that may go against its culture. In

Qatar is a highly restricted country in terms of the internet freedom. It keeps blocking different websites that may go against its culture.

You may look for the best free security tool for Qatar. But, it will not work best. You must try the paid, best security tool for Qatar that is reliable and highly secured. CovermeVPN the best security tool for Qatar.

Other Questions
The facts you find in reference source that support your data in an experiment Article 2 covers the Presidency. In what ways are presidents free to exercise their own power? In what ways are presidents limited in now they exercise their power? What are the next three terms in the sequence, 500, 100, 20? A mechanic applies a force of 200n at the end of a snappnes of length 20cm. what is the moment applied to the nut? The counting rule that is used for counting the number of experimental outcomes when n objects are selected from a set of n objects where order of selection is not important is called the rule for?. O how would erikson classify darrel and what would he predict concerning late adulthood? Under a microscope, a single celled organism 200 microns in length appears to be 50 millimeters long. If 1 millimeter =1000 microns, what magnification setting (scale factor) was used? Explain your reasoning. Suppose an economic boom causes incomes to increase and, at the same time, drives up wages for the sales representatives who work for cell phone companies. this will cause the:_________ americas shifting views on immigration? If you described washington, d.c. as being south of new york city, you would be describing its . question 10 options: absolute location exact location longitudinal location relative location Read the following passage from Anne of Green Gables by Lucy Maud Montgomery. Answer the question that follows the text."Oh, you can talk as much as you like. I don't mind.""Oh, I'm so glad. I know you and I are going to get along together fine. It's such a relief to talk when one wants to and not be told that children should be seen and not heard. I've had that said to me a million times if I have once. And people laugh at me because I use big words. But if you have big ideas you have to use big words to express them, haven't you?""Well now, that seems reasonable," said Matthew."Mrs. Spencer said that my tongue must be hung in the middle. But it isn'tit's firmly fastened at one end. Mrs. Spencer said your place was named Green Gables. I asked her all about it. And she said there were trees all around it. I was gladder than ever. I just love trees. And there weren't any at all about the asylum, only a few poor weeny-teeny things out in front with little whitewashed cagey things about them. They just looked like orphans themselves, those trees did. It used to make me want to cry to look at them. I used to say to them, 'Oh, you POOR little things! If you were out in a great big woods with other trees all around you and little mosses and Junebells growing over your roots and a brook not far away and birds singing in you branches, you could grow, couldn't you? But you can't where you are. I know just exactly how you feel, little trees.' I felt sorry to leave them behind this morning. You do get so attached to things like that, don't you? Is there a brook anywhere near Green Gables? I forgot to ask Mrs. Spencer that.""Well now, yes, there's one right below the house.""Fancy. It's always been one of my dreams to live near a brook. I never expected I would, though. Dreams don't often come true, do they? Wouldn't it be nice if they did? But just now I feel pretty nearly perfectly happy. I can't feel exactly perfectly happy becausewell, what color would you call this?"She twitched one of her long glossy braids over her thin shoulder and held it up before Matthew's eyes. Matthew was not used to deciding on the tints of ladies' tresses, but in this case there couldn't be much doubt."It's red, ain't it?" he said.The girl let the braid drop back with a sigh that seemed to come from her very toes and to exhale forth all the sorrows of the ages."Yes, it's red," she said resignedly. "Now you see why I can't be perfectly happy. Nobody could who has red hair. I don't mind the other things so muchthe freckles and the green eyes and my skinniness. I can imagine them away. I can imagine that I have a beautiful rose-leaf complexion and lovely starry violet eyes. But I CANNOT imagine that red hair away. I do my best. I think to myself, 'Now my hair is a glorious black, black as the raven's wing.' But all the time I KNOW it is just plain red and it breaks my heart. It will be my lifelong sorrow. I read of a girl once in a novel who had a lifelong sorrow but it wasn't red hair. Her hair was pure gold rippling back from her alabaster brow. What is an alabaster brow? I never could find out. Can you tell me?""Well now, I'm afraid I can't," said Matthew, who was getting a little dizzy. He felt as he had once felt in his rash youth when another boy had enticed him on the merry-go-round at a picnic."Well, whatever it was it must have been something nice because she was divinely beautiful. Have you ever imagined what it must feel like to be divinely beautiful?""Well now, no, I haven't," confessed Matthew ingenuously."I have, often. Which would you rather be if you had the choice-divinely beautiful or dazzlingly clever or angelically good?""Well now, I-I don't know exactly.""Neither do I. I can never decide. But it doesn't make much real difference for it isn't likely I'll ever be either."In a minimum of one paragraph, explain what you learn about these characters from this interaction. Use details from the passage to support your response. A 25.0-g sample of pure iron at 85 C is dropped into75 g of water at 20. C. What is the final temperatureof the water-iron mixture? When using storage phosphor plates what equipment is necessary in addition to computer software? Where would the following activity BEST fit on the physical activity pyramid?YogaThe Physical Activity Pyramid: Top level of pyramid is Sedentary activities, Second level is Anaerobic and Flexibility activities, Third level is Aerobic activities, and bottom level is Lifestyle activities. Mrs.Cody needs 1 3/4 yards of fabric to make a pillow. How many yards of fabric will she need to make 12 pillows? The notion that every stimulus pattern is seen in such a way that the resulting structure is as simple as possible is called the law of. elizabeth cady stanton emphasized the importance of her ideas in the declaration of sentiments by:A. suggesting that men's noble characters would lead them tosupport women's rights.B. writing in the same style as that of the Declaration ofIndependence.C. using harsh language and threats throughout the document.D. directly comparing women's rights to African American rights. Solve each equation. Check your answer. 43-3 d=d+9 You are holding two balloons of the same volume. One balloon contains 1. 0 g of helium. The other balloon contains neon. What is the mass of neon in the balloon?. SOMEONE PLEASE HELP ME