1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Hatshy [7]
3 years ago
6

Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T

he output of the program is every word in the list that contains the character at least once. 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'.
5.23.1: LAB: Contains the character
#include
#include
using namespace std;
int main() {
/* Type your code here. */
return 0;
}
Computers and Technology
1 answer:
hammer [34]3 years ago
4 0

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

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

<em>    cin>>inpt; </em>

<em>    vect.push_back(inpt); } </em>

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

       }

}  

You might be interested in
Help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!​
Virty [35]

Answer: the body shape is skinny

4 0
3 years ago
Which of the following describes evolution in the SDLC model?
stira [4]

Completing the requirements analysis is the evolutionary step of the Software development life cycle (SDLC). Hence option 3

<h3>What is the software development life cycle?</h3>

The SDLC is a method for evaluating and improving the development process. It enables a fine-grained study of each process phase. As a result, firms are able to maximize efficiency at each level.

SDLC aids in the achievement of these objectives by detecting inefficiencies and increased costs and resolving them so that everything runs smoothly.

Thus, Initial needs and architecture planning must be completed and are considered as an evolution in the SDLC model

Learn more about SDLC:

brainly.com/question/26366977

#SPJ1

4 0
2 years ago
An indicator is a comprehensive analysis of critical information
ioda

Answer:

True.

Explanation:

An indicator is a comprehensive analysis of critical information by an adversary normally providing the whole picture of an agency's capabilities.

Hope this helps!

3 0
4 years ago
A bin contains 100 sty le a notebooks, 100 style b notebooks, and 100 style c notebooks. antoine will select 3 notebooks from th
emmasim [6.3K]
<span>The answer is Ten.  Substituting numbers for letters, available selections are 111, 112, 113, 122, 123, 133, 222, 223, 233, 333.  Note that, for example, 112, 121, and 211 are considered as the same selection.
</span>AAA, BBB, CCC, <span>AAB, AAC, </span><span>BBC, </span><span>ABB, ACC, </span><span>CCB & ABC.</span>
7 0
4 years ago
Calculate how many different pixel colours could be formed if one of the bytes gives the intensity of the red colour, one of the
Elena L [17]

Answer: The three RGB colors are each 8-bits (possible values [0.. 255], 2 to the power of 8 = 256) of each of Red, Green, and Blue. The three 8-bit RGB components can create up to 256×256×256 = 16.7 million possible RGB color combinations, called 24-bit "color".

Explanation:

6 0
3 years ago
Other questions:
  • To connect multiple usb devices to a single usb port, a ____ can be used.
    12·1 answer
  • Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment v
    5·1 answer
  • the part of the computer that contains the brain , or central processing unit , is also known the what ?
    12·1 answer
  • Which is a tool that allows you to copy formatting from one place and apply it to other places?
    9·1 answer
  • a. Do you think the U.S. government should censor information on the Web, such as instructions for making weapons, to protect th
    12·1 answer
  • How do I learn coding? Python
    5·2 answers
  • The most common clefs for high notes are what?
    6·2 answers
  • Write short notes about monitor printer and speaker​
    14·2 answers
  • The USGS and National Weather Service have many sensors collecting data about natural events.
    8·2 answers
  • In balloon framing, the second floor joist sits on a horizontal framing member called a _____.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!