5.23 LAB: Contains the character
Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Add a newline to the end of the last output. Assume at least one word in the list will contain the given character.

Ex: If the input is:

4 hello zoo sleep drizzle z
then the output is:

zoo,drizzle,
To achieve the above, first read the list into a vector. Keep in mind that the character 'a' is not equal to the character 'A'.

Answers

Answer 1

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

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

  cin>>inpt;

  vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

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

  size_t found = vect.at(i).find(ch);  

      if (found != string::npos){

          cout<<vect.at(i)<<" ";

          i++;

      }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

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

  cin>>inpt;

  vect.push_back(inpt); }

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

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

This checks if vector element contains the character

  size_t found = vect.at(i).find(ch);  

If found:

      if (found != string::npos){

Print out the vector element

          cout<<vect.at(i)<<" ";

And move to the next vector element

          i++;

      }

}  


Related Questions

How to square a number in java.

Answers

Answer:

num**2

Explanation:

To square a number in Java, you just take the number and use two asterisks (**) to denote an exponent, and then connect a 2 to it.

For example, if your number is 5:

5**2 in Java means 5^2, which is 25.

Just like how 5**3 in Java means 5^3.

Hope this helps.

________ programming techniques consist of top-down program design, pseudocode, flowcharts, and logic structures. Group of answer choices Object-oriented Structured Unstructured Content-markup

Answers

Considering the programming layout, Structured programming techniques consist of top-down program design, pseudocode, flowcharts, and logic structures.

Definition of Structured Programming Technique.

This is because Structured Programming techniques are a method that is employed to enhance the reliability and simplicity of the program code.

Configurations of Structured Programming Technique.

Structured Programming Techniques generally takes three structures body which include the following:

IF THEN ELSE DO WHILESequence

Hence, in this case, it is concluded that the correct answer is option B. "Structured."

Learn more about programming techniques here: https://brainly.com/question/17180300

5G can support more users simultaneously than LTE, but it may not provide any improvements in terms of data rates. True or False

Answers

It looks like it should be true because I learned it from my dad

What are the names of the methods which are used to control an i/o device??.

Answers

Answer: 1

Explanation:

i took the quiz and it was correct

TRUE OR FALSE: Bomb threat checklists are extremely valuable and should be made available at all workstations.

Answers

Answer:

True

Explanation:

"Bomb threat checklists are extremely valuable and should be made available at all workstations. If your organization does not have a bomb threat checklist, print the sample for future reference. Keep a copy of the checklist at your workstation at all times."

Choose the response that best completes the following statement.

"If you're not sure if you should be on a site or signing up for a profile, ________."

ask permission
consider the outcome
don't say it online
use the 5-second pause

Answers

Answer:

probably the 5 second pause

consider the outcome?

poob bn vbyfcfgxfc jghjg jhgh

Answers

Answer:

Ploob was a monster employed at Horville's Hut of Horrors. He looked like a small green ball with a long tube-like nose and hair along his spine.

Explanation:

5. The Shape Fill drop-down menu is used to

A b or c or d

Answers

Answer:

Change the color of the shape.

Explanation:

In the sentence, you must look at keywords, like "Fill" and "Shape".

The fact that it said shape fill means the tool would fill the inside of a shape.

Make sure to look at the definition of keywords to figure out what they mean.

Therefore, "Change the color of the shape" would be the correct answer.

-kiniwih426

What is the complete path and filename of the file where ports and their associated protocols are defined

Answers

The /etc/services is often found in Linux/Unix.

The complete path and filename of the file where ports and their associated protocols are defined by /etc/services.

Linux Services files is known to save a lot of well-known ports. UNIX operating systems is known to save a services file at /etc/services.

It does save information about a lot of services that client applications can use on the computer.

Looking into the file, you will find the service name, port number, and protocol it uses, and other applicable aliases.

the work of the configuration file /etc/services is to help programs to be able to do a getportbyname() sockets call in their code so as to know what port they can use.

Learn more about Computer services from

https://brainly.com/question/3837126

DES is a commonly used symmetric encryption algorithm, developed in the mid-1990s by the American government in conjunction with IBM, and is the recommended encryption algorithm for highly sensitive data. True False

Answers

Answer:

False

Explanation:

The DES encryption standard is believed to be weakened by the American government by containing shortened key lengths and 'S-boxes' of unknown origin.

When a single physical computer runs this type of software, it operates as though it were two or more separate and independent computers.

Answers

Answer:

Virtualisation

Explanation:

The correct answer would be virtualisation software, this is because it allows more computers to be "created" in the form of virtual machines. These virtual machines contain everything that a regular computer would have, i.e networks, storage devices, and processors except that it is virtual. You just need to have hyper v enabled in system settings.

Hope this helps!

The ______is the first part of a packet that contains the source and destination addresses. Select your answer, then click Done.

Answers

The first part of a data packet that comprises the source and destination addresses of a network is called a: header.

In Computer networking, the transmission control protocol/Internet protocol (TCP/IP) model refers to a standard networking protocol that allows network devices and host computers to interconnect and communicate with one another over a network, especially through the transmission of data packets and an Internet protocol (IP) address.

Generally, an IP address is typically designed and developed to hold information about data packets. Thus, a header is the information at the beginning of a data packet that comprises the source and destination addresses of a network.

In conclusion, a header is the first part of a data packet that comprises the source and destination addresses of a network.

Read more on header here: https://brainly.com/question/20629962

Six months ago, you purchased a new laptop. Since then, you notice that the battery life has been steadily going down. When it was new, and full charge lasted about three hours. Now your lucky to get two hours before the battery charge level drops the 5%. What should be your first step to correct the problem?a. Calibrate the batteryb. Replace the power meter chip on the batteryc. Clean the contacts on the batteryd. Buy a new battery

Answers

Answer:

A. Calibrate the battery

Explanation:

It is unlikely that the battery has deteriorated significantly in the timespan of six months. The laptop is likely being shut down due to inaccurate battery levels to protect the laptop. Battery calibration will ensure accurate battery information is reported.

Molly needs to access a setting in microsoft windows group policy to change the type of a network to which a computer is attached. Which setting must molly change?.

Answers

A computer is made up of different network. The setting that molly must change is network type.

A computer network is known to be a group of computers that are linked to each other so as to help the computer to communicate with another computer and share their resources, data, and applications.

A computer network can be classified based on their sizes. A computer network is of four types. They are:

LAN(Local Area Network)

PAN(Personal Area Network)

MAN(Metropolitan Area Network)

WAN(Wide Area Network)

Learn more from

https://brainly.com/question/14200752

When it is being used to make a telephone call, your smartphone is an example of which part of the communication process

Answers

In the communication process, when your smartphone is being used to make a telephone call, your smartphone is an example of a: medium.

Communication refers to a process which involves the transfer of a message (information) from an individual (sender) to another (receiver), through the use of semiotics, symbols and signs that are mutually understood by both the sender and the receiver.

The Sender Message Channel Receiver (SMCR) model of communication is composed of four (4) main components and these are;

Sender (S).Channel (C) or Medium.Message (M).Receiver (R).

In the communication process, a smartphone which is being used to make a telephone call is an example of a medium or channel because it provides the pathway for the transmission of a message (information) from an individual (sender) to another (receiver).

Read more: https://brainly.com/question/17438207

_____ is a privacy issue relating to the responsibility of those who collect data must ensure that the data is correct.

Answers

Answer:

Virtual private network

what is the kybert satellite

Answers

Answer:

i dont know....there is nothing on that piece of technology

Explanation:

A technology ____ begins with the birth of a new technology and ends when that technology reaches its limits and dies as it is replaced by a newer, substantially better technology.

Answers

Answer:

A technology __cycle __ begins with the birth of a new technology and ends when that technology reaches its limits and dies as it is replaced by a newer, substantially better technology.

Explanation:

Hope its help

Ask what kind of pet the user has. If they enter cat, print "Too bad...", if they enter dog, print "Lucky you!" (You can change the messages if you like). Once this works, add other pets. (Iguana, Pig, Rabbit...)

Answers

Answer:

Explanation:

a = input("what kind of pet the user has")

if a == 'cat':

  print("Too bad")

elif a == 'dog':

   print("Lucky you!")

Conceptually, a page table is an array. What is found in each element of the page table array, and how is it interpreted?.

Answers

An array is the group of data structure which has a similar data elements of the same data type. In this type of data structure, the information can be quickly recalled by making use of the index number so that each individual data can be retrieved.

With this in mind, we can see that a page table has to do with the data structure which is stored in a virtual memory so that the Operating System can access their virtual and physical address.

See attached image for a better visual description.

Please note that your question is incomplete so I gave you a general overview so that you would better understand the concept.

Read more about page table here:

https://brainly.com/question/15409133

The implementation stage of the SDLC is when the system is moved into operation where it can be used. What stage PRECEDES the implementation stage and what happens in this preceding stage

Answers

The stage that precedes the implementation stage of SDLC is testing and it involves checking the functionality of the system.

System design involves the process of determining an overall system architecture, which typically comprises the following:

Hardware.End users.Physical processing components.Software.Communication channel.

Generally, there are seven (7) main stages in the systems development life cycle (SDLC) model and these include:

1. Planning.

2. Analysis.

3. Design.

4. Development.

5. Testing.

6. Implementation.

7. Maintenance.

From the above, we can deduce that the stage which precedes the implementation stage of SDLC is testing.

During the testing stage of SDLC, a quality assurance (QA) expert checks the system to determine whether or not it is functioning properly before it is deployed for operation, which is where the system can be used.

Read more: https://brainly.com/question/20813142

Pedestrians, bicyclists, and skateboarders _____ the rules of right-of-way when they use the road.

Answers

Pedestrians, bicyclists, and skateboarders must follow the rules of right-of-way when they use the road.

Choose the correct function to yield the shown result.
>>>____(3)
3.0

- int
-round
-float
-str

Answers

Answer:

int

Explanation:

Correct on edg test 2021

PLEASE HELP! (NO LINKS)

The US Copyright Act gives computer programs the same status as what kinds of work?

Answers

Answer:

C.

Explanation:

In image below.

                                        Have a wonderful day and mark brainliest if I helped,

                                                                   starkitty052010 of Brainly

                                       

Modems communicate data by using which method?.

Answers

Considering the modem technology, Modems communicate data by using Radio frequency method.

What is Radio frequency method?

The radio frequency method in modem communication allows modems to communicate or transfer data through wireless over a distance of tens of kilometers.

The essence of Radio frequency in modems

With radio frequency, modems can easily communicate without telecommunication or satellite network operators. It usually performs at 300 MHz to 900 MHz range.

Hence, in this case, it is concluded that the correct answer is the Radio frequency method.

Learn more about modem technology here: https://brainly.com/question/9617717

What are web protocols.

Answers

Answer:

Web protocols are a set of standards used to exchange information. It ensures that code can be modular and portable.

Answer:

The standard network protocol of the Internet, TCP/IP, stands for Transmission Control Protocol/Internet Protocol. The Internet Protocol part of the standard refers to the addressing of data message packets. Additional protocols that operate within the TCP/IP framework include UDP, HTTP and FTP. Each has different functions and purposes that ultimately work together to provide assorted capabilities through what's currently known as the World Wide Web.

Explanation:     i hope this helps

Amelie is planning a gingerbread house making workshop for the neighborhood, and is writing a program to plan the supplies. She's buying enough supplies for 15 houses, with each house being made out of 5 graham crackers. Her favorite graham cracker brand has 20 crackers per box. Her initial code:

Answers

The line of code that successfully calculates and stores the number of leftover crackers in the final box is extras ← crackersPerBox - (neededCrackers MOD crackersPerBox).

From the complete information, her initial code is given as:

numHouses ← 15

crackersPerHouse ← 5

crackersPerBox ← 20

neededCrackers ← crackersPerHouse * numHouses

It was depicted that Amelie realizes that she'll need to buy more crackers since the crackers come in boxes of 20.  Therefore, to calculate how many graham crackers will be leftover in the final box, the line of code from the options will be extras ← crackersPerBox - (neededCrackers MOD crackersPerBox).

Read related link on:

https://brainly.com/question/25663035

five types of conflict in the school​

Answers

Answer:

Conflicts can be classified into five different types: structural, value, relationship, interest, and data [

Explanation:

Answer:

Conflicts can be classified into five different types: structural, value, relationship, interest, and data

Explanation:

follow me please

An agile team has which two characteristics? (choose two. ).

Answers

A SAFe Agile teams are often known to be Scrum Master and Product Owner. An Agile team characteristics are:

A small group typically 5 - 11 dedicated individuals who have the skills necessary to define, build, test, and deploy increments of value.

A group of dedicated individuals who are empowered, self-organized, self-managing, and deliver value.

A SAFe Agile team is a cross-functional group  as they are made up of about of 5-11 people who set apart, build, test, and deliver an increment of value in a short time box.

Agile team are known to be cross functional as they can define, build , test and Deploy.

See full question below

An Agile team has which two characteristics? (Choose two.)

A) A small group typically 5 - 11 dedicated individuals who have the skills necessary to define, build, test, and deploy increments of value

B) A stand-along unit of individuals who do not require input fro other teams to complete their tasks

C) A large group of individuals who all work together to create value for the client

D) A group of dedicated individuals that work in phase-gate steps to complete their PI Objectives

E) A group of dedicated individuals who are empowered, self-organized, self-managing, and deliver value

Learn more from

https://brainly.com/question/24390635

Chapter 20 reading and vocab review

Explain the subtractive and additive approaches to editing.

Answers

Answer:

Essentially additive editing and stringing “the good stuff” together, whereas subtractive is more about stringing all your raw footage together and “removing the bad stuff”

Additive editing feels confident and concerned with the pursuit of a specific, existing vision. And it’s faster. Subtractive editing feels like a deeper listening to what the footage is saying, and holding on to many potential permutations.

Explanation:

Addictive editing -  creating a program from raw footage by starting by starting with nothing and adding selected components

Subtraction editing  - creating a program by removing redundant or poor quality material from the original footage

Other Questions
If there are 357 chairs in 7 rows,how many chairs are in each row given the equation 3x-2y=-10, identify the slope and the y-intercept What type of molecule is pentanal?A. AldehydeO B. KetoneO C. AlcoholO D. Ester What is the charge on ion X for Li2 X If a DNA molecule has 40% Cytosine, what percent of it would be Adenine? Explain your reasoning. what do i do for #17 How do you know if a relationship between two quantities is not proportional Evaluate the triple integral.Ey dV, where E = {(x, y, z) | 0 x 6, 0 y x, x y z x + y} Three times a number is three more than twice the number. Which equation can be used to find the value of x, the unknown number? 3x = 3 2x x = 3 2x 3x 3 = 2x 3x = 3 2 x. Psychographic segmentation of Starbucks Margie's hourly salary is $6. 75. Last week she worked a 20hour week. How much did she earn?. help pppplsssssssssss HELP ASAPPP (WHOLE PAGE) 7th grade math help... COMMUNICATION Complete the conversations, using the words or phrases given.love dont mind hate dont really like quite likeA Nick: Jenny, please help me with the washing up. Jenny: Why? Theres not much. Nick: I know, but I (1)___________ doing it. Its awful.B Mum: Let me help you. Sarah: No, thats OK. I (2)___________ doing the cooking. Its one of my favourite hobbies.C Phong: What are you doing? Phuc: Im tidying my room. Phong: What? Still? Phuc: Yeah, I (3)____________ doing it. Its a bit boring.D John: And we also need lots of drinks. Shall I come with you? Mai: No, Im fine. I really (4)____________ shopping.E Mum: Ok, give me the next shirt. I (5)__________ doing another one. Mai: You really dont mind? How sweet of you. Is krypton a good or poor conductor of electricity? Why? I What is an area of skin innervated by a certain spinal or cranial nerve that sends information about sensations of touch, temperature, and pain back to the CNS? PLEASE HELP WITH THIS Find the value of x and y. Which of the following factors best supports the argument in the excerpt?.