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
A Pool charges $4 each visit,or you can buy a membership. Write and solve an inequality to find how many times a person should u
MAXImum [283]
$4 x number of visits (V)> price of membership (M)
V > M/4
8 0
3 years ago
A user deletes a message from a mailbox while on a desktop. What happens to the email message on the user's synchronized devices
gulaghasi [49]

Answer:

Explanation:

Depends on the configuration of the email because there are two protocols POP and IMAP, the most recent protocol is IMAP, we can delete an email and this It moves to a To be Deleted folder, this happens because the email is stored in the server, but with the protocol POP the email is stored in the server and downloaded to the application, if you delete an email, this is deleted in all devices.

8 0
3 years ago
Read 2 more answers
A popular Voice over Internet Protocol (VoIP) service is ________.
Aloiza [94]
The answer would be Skype
8 0
2 years ago
Which framework can be used to develop cross-platform applications?
k0ka [10]

Answer:

Qt framework

Explanation:

3 0
3 years ago
How is the “conflict set” defined in Production systems?How conflict is resolved ?
Triss [41]

Answer:

The rules which could trigger at any period in time are referred to as the conflict set. A programming bug/conflict can occur when two programs compete for the same resource such as memory or register etc.

A Conflict Resolution Strategy is is a protocol which highlights which decision will be triggered first.

The best way to resolve conflict is to first determine the kind of conflict it is. Hardware conflicts can be resolved by first troubleshooting the hardware and in some instances unplugging the hardware causing the conflict.

When hardware creates conflicts it may be due to a driver issue. reverting to an old driver or updating the existing one may solve the problem.

Software conflicts can be resolved by installing updates or complete uninstallation.

Cheers!

5 0
2 years ago
Other questions:
  • Only put coolant into your radiator when the engine is<br> A. on<br> B. hot<br> C. warm<br> D. cool
    6·1 answer
  • To find temporary windows files begin by typing in the search box
    6·1 answer
  • Which term describes the process by which light passes through an object or a medium.
    7·2 answers
  • The network topology in which each device is connected directly to a central network switch
    9·1 answer
  • Jesse is trying to find a computer file. he types the name of the file into the computer search bar. the computer is most likely
    5·2 answers
  • Print a countdown from n to 1 The function below takes one parameter: an integer (begin). Complete the function so that it print
    8·1 answer
  • A keyboard is a/an _____. interconnector port packet NAS
    7·1 answer
  • Sebutkan beberapa contoh peralatan komunikasi zaman dahulu beserta dengan keterangannya!
    14·1 answer
  • What are the importance of Help and Support feature of Windows​
    6·1 answer
  • Need help with a program to search to sort elements in an array.(increasing or decreasing order)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!