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
An attacker is preparing to perform what type of attack when the target vulnerabilities include headers and payloads of specific
kari74 [83]

An attacker is preparing to perform what Application attack  when the target vulnerabilities include headers and payloads of specific application protocols.

<h3>What Is an Application Attack?</h3>

An application attack is known to be a type of system attack which is made up of cyber criminals that is said to have access to any unauthorized points.

Note that this kind of Attackers are  the ones that start by  looking at the application layer, and then looking for any kind of application vulnerabilities that is found within the code.

Learn more about vulnerabilities from

brainly.com/question/25633298

3 0
2 years ago
What type of measurement are each of the following
bixtya [17]

Answer:

unities

Explanation:

Every one may be counted in unities

3 0
2 years ago
What are two key elements of describing the environment?​ a. ​ Communication protocols and security methods b. ​ External system
pashok25 [27]

Answer:

B. External systems and technology architecture.

Explanation:

In such environment, you have to know what external systems are in place so have proper communication with External Systems whether be in message format or web/networks, Communication protocols, Security methods, Error detection and recovery,

Additionally, it consits of technology architecture so conforming to an existing technology architecture helps us discover and describe existing architecture

3 0
3 years ago
Jasmine is a commercial artist her is is the one most often used by graphic designers publishers and others in her field the os
VikaD [51]
OS is for mac so she used the mac computer
7 0
2 years ago
What is the very first tag you must enter into a new HTML Document?
podryga [215]

Answer:

<HTML> tag

Explanation:

The first tag in any HTML file is the <HTML> tag. This tells web browsers that the document is an HTML file

4 0
3 years ago
Read 2 more answers
Other questions:
  • Changes in the ownership of a file do not change the amount of data that is considered to belong to a user.
    12·1 answer
  • How many possible keys does the playfair cipher have? an approximate power of 2
    14·1 answer
  • Rapid development programming languages eliminate the possibility of having bugs in code. True or False
    8·1 answer
  • What part of the code is a signal for the function to execute and pass back a value?
    11·2 answers
  • Why are specification for food processing tool,equipmentand untensils necessary?​
    8·1 answer
  • A simple system is to be designed to allow for the selling of old books. There are two different types of users: buyers and sell
    6·1 answer
  • What is the hexadecimal equivalent of the decimal number 256?
    11·1 answer
  • Using recursion, write a program that asks a user to enter the starting coordinates (row, then column), the ending coordinates (
    12·1 answer
  • 8.
    9·1 answer
  • What are the functions of super computer?<br> ​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!