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
Web-based applications are application software which operate and can be accessed through _____________. The World Wide Web Stor
bearhunter [10]

a web browser i think

4 0
3 years ago
Read 2 more answers
Examine the information in the URL below.
ololo11 [35]

Answer:

B The subdomain is /home/ and the domain name is http://.

Explanation:

7 0
3 years ago
A _ operating system is usually used in personal computers
Eddi Din [679]
A windows operating system.
Or linux/Mac.
4 0
3 years ago
Which of the following is a good way to get other websites to link to your site?
andreev551 [17]

Answer:

Building relationships with similar sites is the correct answer.

Explanation:

Because it is necessary to maintain or establish a relationship with similar sites by which they link your website and this is a good way to popularize your website and get more customers through the building of the relationship with similar sites. By this relationship, you can increase the rating and provide the goods or services to your customers easily.

8 0
3 years ago
ABC inc. has built a large, normalized, relational database to capture current/historical data originating /copied from its tran
kow [346]

Answer:

"Datawarehouse" is the correct answer for the above question.

Explanation:

  • The Datawarehouse is a collection of large data or database which holds the historical data and the current or operation data for future decisions of the profit of the organization.
  • The decision can be made after being analyzed the data which is extracted from the Dataware house.
  • The above question also states the database which works like the above-defined concept. Hence Datawarehouse is the correct answer to the above question.
6 0
3 years ago
Other questions:
  • What three characteristics of a function are described in an IPO chart? What is performed at each characteristic?
    12·1 answer
  • Matt wants to build an app that will reach many people all over the world. However, he worries about having to modify apps for a
    14·1 answer
  • A company that hires only American Indians is practicing
    5·2 answers
  • 1.What is Intellectual Property
    9·1 answer
  • 2. Feet to Inches One foot equals 12 inches. Design a function named feetToInches that accepts a number of feet as an argument,
    8·1 answer
  • What is better in everybodys opinion. AMD or Intel?
    9·2 answers
  • You can minimize the Ribbon with a command contained on the _____.
    7·1 answer
  • Professor Gig A. Byte needs to store text made up of the characters A with frequency 6, B with frequency 2, C with frequency 3,
    10·1 answer
  • Which of the following correctly stores 45 squared in the variable x?
    11·1 answer
  • If your computer determines the destination address of a network packet is to a remote network.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!