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

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!")

Lloyd works for a graphic design company. He needs a monitor that accurately represents colors. Lloyd's monitor recently failed, and you have been asked to purchase a new one. You have been asked to find a monitor with a fast pixel refresh rate, low energy consumption, and very accurate colors representation.

Required:
What types of display devices will BEST meet the requirements requested?

Answers

OLED simply stands for Organic Light-Emitting Diode. It is often regarded as a type of technology that uses LEDs in which the light is produced by organic molecules. The types of display devices will best meet the requirements requested OLED.

They are often regarded as organic LEDs that are used to produce display panels.

OLED displays are produced with a number of organic thin films between two conductors. It has a form of a simple design that has a lot of merits over other display technologies.

These technology are mostly used today in mobile devices as they give a better image quality.

Learn more from

https://brainly.com/question/14781150

the disk you inserted was not readable by this computer

Answers

Answer:

It may not be compatible with your type of your computer.

Explanation:

Plz give brainliest :)

In a complex formula, how does excel determine which calculation to perform first?.

Answers

In a complex formula, the way excel determines which calculation to perform first is that; It follows the order of operations.

When carrying out calculations in excel, if we don't bracket certain operations, excel will use the order of operation called BODMAS to determine which operation to carry out first.

For example, if excel wants to solve 3 × 4 + 7 - 2;

The acronyms in BODMAS stand for;

B - Brackets

O - Orders (powers/indices or roots)

D - Division

M - Multiplication

A - Addition

S - Subtraction

Now, it means that the first action it will perform is Bracket while the last will be subtraction.

In our example, excel will first use the multiplication sign to get;

(3 * 4) = 12

Then addition; 12 + 7 = 19

Then subtraction; 19 - 2 = 17

Read more on BODMAS at; https://brainly.com/question/16788360

________________ is access to the internet through your tv connection.

Answers

Answer:

Cable Modem

Explanation:

Kyra is protesting corruption in the mayoral office. She is afraid that the mayor has access to her emails where she discusses his wrongdoings. Which of the following laws protects her electronic communication from being accessed by the government or law enforcement agencies?

Answers

Answer:i don’t know sorry

Explanation:

You have 5 salespersons who work out of your office and who frequently leave their laptops laying on their desk in their cubicles. You are concerned that someone might walk by and take one of these laptops. Which of the following is the BEST protection to implement to address your concerns?
a. Require strong passwords in teh local security policy.b. Use cable locks to chan the laptops to the desks.c. Implement screen saver passwords.d. Encrypt all company data on the hard drives.

Answers

There are different ways to ensure safety of devices. The best protection to implement to address your concerns is to use cable locks to chain the laptops to the desks.

The use of laptop locks is as good as when compared to bicycle chain locks. One can do this by looking for a big, immovable object, such as one's desk, and thereafter you wrap the metal cable around it and then insert the lock into your laptop's lock slot.

With this, your computer becomes theft-proof.

Thia will give you piece of mind as you will not be restless anymore.

Learn more about Laptop security from

https://brainly.com/question/24956493

Daphne has determined that she has malware on her linux machine. She prefers to only use open-source software. Which anti-malware software should she use?.

Answers

Answer:

ClamAV is the open source antivirus you can in your Linux machine.

ClamAV is one of the best open-source anti-malware software for Linux machines.

What is malware?

Any program or file that purposefully hurts a computer, network, or server is known as malware or malware. Computer viruses, worms, Keyloggers, extortion, and spyware are examples of infection.

By analyzing all received packets to stop malware from being launched and infiltrating a computer, antiviruses can assist in preventing malware attacks. Antimalware software can also identify sophisticated malware and provide defense against ransomware assaults.

Hence "One of the top free anti-malware programs for Linux systems is ClamAV".

To learn more about malware,

https://brainly.com/question/22185332

#SPJ12

Project: On Assignment as a Web Developer
Assignment Directions:

Create a web page for a fictitious company: Widgets Inc. has hired you to make a mock-up for their new website. They are on a budget and only want to have a presence on the Internet. They do not need any fancy bells and whistles. They have sent you an email message with the basic parameters of the site.

The site should have at least three pages. They should include the landing page (commonly named index.htm), a contact page, and a "Meet the Company" page.
Each page should have an identical header containing the company name and motto: "We make widgets fun!"
Each page must include navigation back to the home page (without needing to use the Back button on the browser).
All font styles and alignment must be performed with inline CSS.
The company mascot is a dog, but there is no logo provided in this project. Any picture of a dog will do. Make sure it is prominently displayed on each page.
Each page should display in a web browser with a title.
All employees on the "Meet the Company" page can be random people's photos from the Internet. Please include Jack Sprat, President, Tom Thumb, Vice President, Sally Flag, Treasurer, and Monty Fuller, Secretary.
All text for these pages can be fake. See this website to create filler paragraphs.
Make up email addresses, but use the mail to: command as a hyperlink and display the person's name and not the actual address.
Each page should have a link to the other pages.
Link to at least three remote web pages. One of these should be formatted in an iframe.
The main page should have a sample product table including the following information:
Name Size Color Lead time Price Discount (for 10)
W-1 1X1 Blue 1 week $200.00 10%
R-2 2X2 Green 1 week $1,200.00 15%
D-2 2X3 Red 2 weeks $12,000.00 20%
Assignment Guidelines:

Projects will be assessed on following the requirements and style. Use color (creatively), at least two typefaces, headings, bold and italics, images, background colors, and so on to make your pages.

Submission Requirements:

Standard HTML

Question # 1

File Upload

Ensure that you fulfill all requirements, then upload your final web page project.

Answers

Answer:

It is not possible to upload files .html files here

What is the quickest option for adding internet images to a PowerPoint presentation?

*it's b. use the online pictures option....

Answers

Answer:

b. Use the Online Pictures option to perform a search of web-based images to insert.

Explanation:is correct. post protected

Independence Day celebration in school paragraph ​

Answers

Answer:

We celebrated the Independence day in our school compound, with great pump and show. The school building and the ground were cleaned and decorated for the occasion. A flag pole was put up at the top of the school building. The seating arrangement was made on the platform

Explanation:

please Mark my answer in brainlist

Vhat is the result when you run the following program?
rint(2 + 7)
rint("3+ 1")
4
O an error statement
2+7
o
4
0
9
3 + 1

Answers

Answer:

4

Explanation:

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.

4. Each mobile device described in this chapter requires that the user have a/an ____________________ associated with services offered by the publisher of the mobile OS in use on the device.

Answers

All mobile devices requires that end users have an account that is associated with services offered by the publisher of the mobile operating system (OS) installed on the device.

A mobile device can be defined as a small, portable, programmable electronic device that is designed and developed for the transmission and receipt of data signals (messages) over a network. Thus, a mobile device must be designed as a handheld device with communication capabilities.

Additionally, mobile devices such as smartphones have a mobile operating system (OS) installed on them, so as to enable them perform various tasks such as:

Taking pictures and creating video files.Typing and sending both text and multimedia messages.Browsing the Internet.Making both audio and video calls.

As a general rule, all mobile devices requires that end users have a registered account associated with the services offered by a publisher of the mobile operating system (OS) installed on the device. This registered account serves as a unique identifier and it connects an end user with the publisher of the mobile operating system (OS).

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

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.

1.What is the output of the following program? [10 Marks]namespace ConsoleApp1{class Program{static void Main(string[] args){int i, j;int [,] A = new int[5,5];for (i = 0; i < 5; ++i){for (j = 0; j < 4; ++j){A[i,j] = i*j;}}for (i = 0; i < 5; ++i){for (j = 0; j < 4; ++j){if (i < 5){A[j, i] = A[i, j];}elsebreak;Console.Write(A[i, j] + " ");}Console.WriteLine();}Console.ReadLine();}}}

Answers

The program outputs the following rectangular array:

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

This is the correctly formatted C# program:

namespace ConsoleApp1{

   class Program

   {

       static void Main(string[] args)

       {

           int i, j;    // declare index variables used to iterate over the array A

           int [,] A = new int[5,5];   // create a 5 by 5 array

           

           /* Iterate over the array with the index variables i and j

               and initialize each location A[i, j] with the product

               of i and j. */  

           for (i = 0; i < 5; ++i)

           {

               for (j = 0; j < 4; ++j)

               {

                   A[i, j] = i*j;

               }

           }

           

           /* Iterate over the array again. This time, swap locations

               A[i, j] with A[j, i] */

           for (i = 0; i < 5; ++i)

           {

               for (j = 0; j < 4; ++j)

               {

                   if (i < 5)

                   {

                       A[j, i] = A[i, j];

                   }

                   else

                       break;

                   

                   // display the current location A[i, j]

                   Console.Write(A[i, j] + " ");

                   

               }

               /* print a newline to prepare for the next line of printing

                   which corresponds to the next column i */

               Console.WriteLine();

                // pause and wait for user keypress before continuing

               Console.ReadLine();

               

               }

           }

       }

   }

When executed, this program simply prints a rectangular array like so;

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

Learn more about predicting program output here: https://brainly.com/question/20259194

true or false windows 98 and windows xp are examples of an operating system?

Answers

Answer:

true

Explanation:

Which of the following is used to regularly update an operating system? App Extension OS Patch

Answers

Answer:

patch

Explanation:

patch, by definition, is an update meant to fix security flaws.

app, extension, and os dont update

To regularly update an operating system is Patch.

What is Patch?Unlike different news apps, the Patch app allows users to subscribe to a personalized newsfeed from considerable cities and towns across the U.S. Following a smooth launch before this year, the app already includes over 233,000 downloads and averages a 4.5-star rating on both the Apple and Android app stores.In 2013, Patch was spun out of AOL as a joint experience with Hale Global. In January 2014, the latest owners reported layoffs of 400 journalists and other workers. In February 2016, The Wall Street Journal documented that Patch had 23 million users, which was advantageous and developing into new territories.The birth management patch may be a good alternative for someone who's sexually active, considers less than 198 pounds (90 kilograms), and discovers it hard to determine to take a pill every day or who keeps trouble ingesting pills. In some cases, medical or other circumstances make the use of the patch less practical or riskier.

To learn more about Patch, refer to:

https://brainly.com/question/20652851

#SPJ2

In object-oriented programming, a data member plays the role of _________. a. an attribute b. a behavior c. either a or b d. neither a nor b

Answers

In object-oriented programming, the object consist of both the data and the functions that operate on the data. In object-oriented programming, a data member plays the role of neither A nor B.

Objects are the product of abstract data types that has inside of it both data and function altogether.

A data member often has different classes. They can be private or public.

Object-oriented programming (OOP) is simply known as a computer programming model that put together software design around data, or objects.

Learn more from

https://brainly.com/question/12342989

1.Write a C++ program that allows the user to enter the phrase "I am smart". Output the first letter and last letter of the phrase using string properties.

2.Write a C++ program to output the following values after they are loaded into an array: 67, 45, 12, 89, 46, 88 and 43.
PLS Help they are different questions

Answers

Answer:

1)

string value;

cout << "type I am smart";

cin >> value; // get user input from the keyboard

2)

int num1 = 67;

int num2 = 45;

int num3 = 12;

int num4 = 89;

int num5 = 46;

int num6 = 89;

int num7 = 46;

int num8 = 88;

int num9 = 43;

int numbers [ ] = {num1,num2,num3,num4,num5,num7,num8,num9} ;

//to load it as a function

int main ()

{

for ( n=0 ; n<5 ; n++ )

{

result += numbers[n];

}

cout << result;

return 0;

}

The C++ programs are illustrations of arrays and strings

The program 1

The program written in C++ is as follows:

#include<iostream>

using namespace std;

int main(){

   //This declares the string

   string myStr;

   //This gets the input

   cin>>myStr;

   //This prints the first and the last index elements

   cout<<myStr[0]<<" "<<myStr[myStr.length()-1];

   return 0;

}

The program 2

The program written in C++ is as follows:

#include<iostream>

using namespace std;

int main(){

   //This initializes the array

   int myArr [] = {67, 45, 12, 89, 46, 88, 43};

   //This prints the array elements

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

       cout<<myArr[i]<<" ";

   }

   return 0;

}

Read more about arrays and strings at:

https://brainly.com/question/15683939

#SPJ2

how to make your phone flash when you get a notification

Answers

Answer:

If your talking about it turning on then go to notifications in the settings and turn on badges. If your talking about the flashlight on ur phone not possible.

Explanation:

Which option ensures that items in a text box or table cell will be in the absolute center of that element?

*i chose b. center, align, middle and got a 100 edg21

Answers

Answer:

Center, Align, Middle

Explanation:is correct. post protected

Diane changes the size of an image with the format picture pane and keeps the original ratio of height to width of the object. What has Diane done to the image?

chose D. she scaled, got 100%

Answers

Answer:

it's d.  

Explanation: post protected

One of the difficult things about working in game design is that while there are many different roles, most of them only match one specific personality type.
True
False

Answers

Answer:

it's false

Explanation:

they don't match to personalities

We use the keyboard to point, click, and select menus and icons, and for onscreen navigation. True or False

Answers

Answer:

False.

Explanation:

Hope I could help. Hey, have a nice study time.

Answer:

false

Explanation:

we use our keyboard to type not click icons or point.

Elan inserted shapes into a slide in his presentation. What is the quickest way to format those shapes?

it's C. Shape Styles gallery got a 100

Answers

Answer:

c. Shape Styles gallery

Explanation: is correct. post protected

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.

I need help with this question

What is the “digital divide”?

A. the gap between people who are very skilled using the Internet and people who are less skilled.

B. the gap between the time before Smartphones debuted and the time they became widely used.

C. the gap between people who have readily available Internet access and people who do not.

D. the gap between the time before the Internet debuted and the time it became popular.

Answers

Answer:

C IS YOUR ANSWERexplanation is available

Explanation:

The digital divide describes the gap between people who have access to affordable, reliable internet service (and the skills and gadgets necessary to take advantage of that access) and those who lack it. ... The Access Divide—This is the most visible digital divide.

Answer:

option c is the answer....

Which is a function of an operating system?.

Answers

Answer:

An operating system is known as the interface between the computer hardware and the user itself. It is one of the most essential parts of a computer, and is the most integral software. It's responsible for executing programs, handling other inputs i.e an additional mouse, keyboard, etc. as well as handling storage for data and other files. In addition to this, it manages the computer's resources as well as executes and enables services.

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
Hello, Sorry To bother you nice ppl but more questions awaits u :) 2. The duration of the ride is 15 min. (a) How many times does the last passenger who boarded the ride make a complete loop on the Ferris wheel what stated of matter and how many phases are present when a 5.0 mL sample of oil is mixed with 100.0 mL of water?A both solid and liquid state= two phasesB two layers of different liquids=two phases C the liquid state only= one phasesD the solid state only=one phase Yankee Candle sells 500 candles in a week for a price of $10 each and the average cost of producing each candle is $5. Yankee Candle's total revenue is What are two drawbacks of using netbook ? (Choose two)A. PortabilityB. Screen sizeC. Boot up timeD. Storage capacity True or False: Cardiac muscle is also known as smooth muscle. y=-6/5x +4 y-= -1/5x -1 What is most closely the central theme of the passage below?Ah, distinctly I remember it was in the bleak December;And each separate dying ember wrought its ghost upon the floor.Eagerly I wished the morrow;vainly I had sought to borrowFrom my books surcease of sorrowsorrow for the lost Lenore For the rare and radiant maiden whom the angels name Lenore Nameless here for evermore.Answer choices for the above questionA. The narrator attempts to distract himself from his grief through reading.B. The fire throws shadows on the floor that look like ghosts.C. Lenore no longer has a name because she is dead.D. The events recounted happened in December. A Literary PerspectivesAnalyzing Political Context in the firstsentence, Mary Wollstonecraft invokes both"the historic page" and "the living world."How does this first sentence help establisha political context for the text? Part D What did the video mean when it used the phrase citizen-scientists? How can citizens-scientists help with the prediction of future earthquakes? "Shopping Spree" - Christine went on a shopping spree. In the first store she spent half of her money plus $2. In the next store she spent half of what was left plus $1. Her purchases in the third store cost half of what was left plus $i. At the last store she spent half of what was left and had $3 to take home. How much money did she start with?I'll give brainliest!!! A recipe requires 2/5 cup of sugar for 1 batch of brownies enter the number of batches of brownies that can be made using 3 1/5 cups of sugar When multiplying numbers with the same base you________ the exponents. What will happen if there is excess and deficit of carbohydrates in the body? For effective price discrimination to occur, a seller must: Which of the following processes are spontaneous under standard conditions? Select all that apply. Multiple select question. A gas is compressed into a small volume. A soluble salt dissolves when it is mixed with water. Iron rusts when it exposed to salty water. A match continues to burns after it is lit. Water moves up into a water tower. The force in Newtons acting on a particle located x meters from the origin is given by the function F(x)=12x2+7. What is the work done in Joules when moving the particle from x=2 to x=5? Fill anwer! 10 Points. 5 for answering 5 or 3 for brainliestthank you! Hi! , im looking for some help here. ill give brainliest if able to. Help pls due tonight