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
What’s the purpose of balancing or monitoring your checking account?
emmasim [6.3K]
B) To help you calculate how much money you have in your account.
3 0
3 years ago
Read 2 more answers
What does phishing mean?
Ilya [14]
<span>the activity of defrauding an online account holder of financial information by posing as a legitimate company

</span>
8 0
3 years ago
Read 2 more answers
Murray University invested over $450,000 in a customized learning management system so that professors could put courses online
emmasim [6.3K]

Answer:

b. User-fierce interfaces

Explanation:

Based on the scenario being described it seems this is an example of User-fierce interfaces. This basically means that the system in question is not very user friendly, which ultimately makes it very difficult for users to understand, use, and manipulate. This tends to cause the users to get frustrated and ultimately stop using the system as they believe it is too difficult and not worth their time. This is what seems to be happening with the customized learning management system in this question since the 20% of the users quit instantly due to the difficulty of the system.

6 0
3 years ago
9. A change in the appearance of a value or label in a cell
alexandr402 [8]

Answer:

format

alignment

excel

=

Explanation: i'm an accountant

4 0
3 years ago
. An operating system is: *
Artemon [7]

Answer:

3. System Software

Explanation:

An operating system is a special type of system software. It controls and co-ordinates overall of the computer.

4 0
3 years ago
Other questions:
  • How can a user choose settings that will customize a presentation so that it is best to be played automatically at a kiosk rathe
    11·2 answers
  • Which of the following is true regarding Moore’s Law? A.) explained the growth in computing capabilities between 1965 and 1995 B
    14·1 answer
  • List 7 basic internal component found in a computer tower?
    11·2 answers
  • With iteration-control systems, each team member ________. is given an account with a set of permissions is given their own priv
    6·1 answer
  • 1. If your motherboard supports DIMM memory, will RIMM memory still work<br>on the board?​
    13·1 answer
  • Outputting all combinations. Output all combinations of character variables a, b, and c using this ordering abc acb bac bca cab
    7·1 answer
  • The February Revolution occurred in January.<br><br><br> True<br> False
    5·2 answers
  • SHORT ANSWERS:
    7·1 answer
  • What is a common misconception about Agile and DevOps?
    9·1 answer
  • Please help me on this it’s due now
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!