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
Anna35 [415]
3 years ago
9

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. For example, if the input is 4 hello zoo sleep drizzle z The output should be Zoo 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
Computers and Technology
1 answer:
guapka [62]3 years ago
6 0

Answer:

/Include required header file.

#include <stdio.h>

//Define the function isWordContainChar() having the

//required parameters.

int isWordContainChar(char* req_word, char search_char)

{

//Declare required variable.

int i;

//Start a for loop to traverse the string given in

//the function parameter.

for(i = 0; req_word[i] != '\0' ; i++)

{

   //If the current character in the gievn word is

   //matched with the character which needs to be

   //found in the word, then return 1.

   if(req_word[i] == search_char)

   {

     return 1;

   }

 }

//Otherwise, return 0.

return 0;

}

//Start the execution of the main() method.

int main(void)

{

//Declare the required variables.

int num_words, index, word_index;

char str_word[20][10];

char searchCharacter;

//Prompt the user to enter the number of words.

scanf("%d", &num_words);

//Prompt the user to enter the required words using a

//for loop and store them into an array.

for(index = 0; index < num_words; index++)

{

   scanf("%s", str_word[index]);

}

//Prompt the user to enter a required character which

//needs to be found in a word.

scanf(" %c", &searchCharacter);

//Traverse the words stored in the array using a for

//loop.

for(index = 0; index < num_words; index++)

{

   //Call the function isWordContainChar() with

   //required arguments in rach iteration and if the

   //value returned by this function is not 0, then

   //display the current string in the array.

   if(isWordContainChar(str_word[index],

   searchCharacter) != 0)  

   {

     printf("%s\n", str_word[index]);

   }

}

return 0;  

}

You might be interested in
What is true about music from the Romantic period?
avanturin [10]
The answer to the given question above is the third option: <span>It was longer and less constrained than the music of the Classical period. The Romantic Period in music actually has more freedom in design and form. During this period, music were even more artistic and intellectual as well. Romantic Period occurred the late 18th century until early 19th century.</span>
8 0
3 years ago
Read 2 more answers
You have one ip address provided from your isp with a /30 mask. However, you have 300 users that need to access the internet. Wh
creativ13 [48]

Answer:

a. PAT

Explanation:

20.You have one IP address provided from your ISP with a /30 mask. However, you have 300 users that need toaccess the Internet. What technology will you use to implement a solution?a.PATb.VPNc.DNSd.VLANs

4 0
2 years ago
Advatages and disadvantages of power-concentrated train​
allochka39001 [22]

Answer:

1. Safety:

2. Cheap:

3. Increases Employment:

4. Bulk Quantity:

The Disadvantages of Rail Transport are as Follows:

1. Loss of Goods:

2. Unsafe for Fragile Items:

3. Late Bookings:

4. Unsuitable for Short Distances:

5. Unsuitable for Rural Areas:

Explanation:1. Safety:

Transportation by the means of railway ensures safety for the desired goods because unlike the road transports a train only stops at a desired station instead of the will of the driver. In case of road transports for example, the drivers can at any point of time decide to rest or stop for tea, refreshments, lunch or dinner.

2. Cheap:

Railway transport any day is cheaper as compared to air transport. As a matter of fact, railway transport is even cheaper than road transport because of the reason that goods in bulk quantities are carried from a desired destination to the other. In cases of road transport for instance, less goods as compared to road transport can be carried.

3. Increases Employment:

Railway transport helps people to carry cheap products from a place to another and sell them at high prices. As a result of this, a number of people who are unemployed find a source of their daily bread.

4. Bulk Quantity:

ADVERTISEMENTS:

Because railway transportation is cheaper as compared to air and road transport, goods can be carried in bulk quantities as a result of which a lot of time is saved.

It is true that as compared to air transport and road transport, rail transport is easier and cheaper but still it has a few disadvantages.

The Disadvantages of Rail Transport are as Follows:

1. Loss of Goods:

Because goods in bulk quantities are carried chances of goods getting lost are high in case of railway transport as compared to air and road transport.

2. Unsafe for Fragile Items:

Railway transportation is particularly unsafe for carrying fragile items like glass because these items can easily break at times when a train halts unexpectedly of when the train is speeding up at times.

3. Late Bookings:

ADVERTISEMENTS:

Because railway is the cheapest medium of transport, it is hard to find suitable bookings for the transportation of your goods. Railway transport is not suitable in cases of emergency.

4. Unsuitable for Short Distances:

Railway transport is unsuitable for carrying goods at shorter distances; road transport is most suitable in this case.

5. Unsuitable for Rural Areas:

Proper railway system is not build up in the Indian villages as a result of which railway transport is unsuitable in the villages of India. Whatever be the disadvantages of railway transport it was, it is and it will always be the safest and the best means for the transportation of goods.

5 0
3 years ago
Which of these YA (young adult movies is not base on a book is it A wrinkle in time, or Midnight sun,or Love,simon.
ExtremeBDS [4]
I think it’s midnight sun
4 0
3 years ago
Which form of media allows the audience to share in and comment on the content immediatly
Luba_88 [7]

twitter

they will allow you to share comments about any topic you want

4 0
3 years ago
Other questions:
  • Which statements describe the advantages of using XML?
    12·2 answers
  • Write a function named shareALetter that takes one parameter, wordList – a list of words. Create and return a dictionary in whic
    13·1 answer
  • Select all of the uses of presentation software in the workplace.
    8·1 answer
  • Jana keeps receiving friend requests from strangers on a social media site. This is making her uncomfortable.
    15·2 answers
  • Which of the following information is most important to include in a timeline
    14·2 answers
  • Which are advantages of using a server operating system?
    12·1 answer
  • What is emerging as a major business area of innovation that offers a flexible collection of computers on the internet that can
    6·1 answer
  • using a timer to generate a random number, develop a program that displays random numbers between 1 and 47 (or whatever) for you
    12·1 answer
  • Giusp minfg gấp vs ạ đáp án thôi nhé
    15·1 answer
  • How does accenture generate value for clients through agile and devops?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!