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
Rus_ich [418]
3 years ago
14

in c Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the li

st. The 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. Assume that the list will always contain less than 20 words. Each word will always contain less than 10 characters and no spaces.
Computers and Technology
1 answer:
Fiesta28 [93]3 years ago
3 0

Answer:

see explaination

Explanation:

//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
These are Spealized graphics programs gor editing or modifying digital photographs
lisov135 [29]
They fall under the category of “Photo Editing Software” or “Image Manipulation Software”
8 0
3 years ago
Which type of disease cannot be spread from one person to another
marusya05 [52]

<u>non-infectious, non-communable</u>. It means that they can't spread. I hope that helps! Also, and example of this non-infectious disease would be diabtetes, as in, if you're next to a person that has it, you won't get it lol.

6 0
3 years ago
Read 2 more answers
Question text<br> In a spreadsheet program, worksheets and documents are present in
olasank [31]

Answer:

workbook

Explanation:

A workbook is a file that contains one or more worksheets to help you organize data.

4 0
3 years ago
Say you have a long string and you want to collect all of the letters within it without storing duplicates. What would be the mo
Bas_tet [7]

A set because sets do not allow duplicated elements

3 0
2 years ago
Please select the word from the list that best fits the definition
antoniya [11.8K]

Answer Is

Safe Sites.

Explaining:

Edu Sites Are For Educational Purposes. So They Need To Be Secure.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m
    15·1 answer
  • Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a li
    15·1 answer
  • Henry must choose which type of smart speaker to use in his home. He asked you to help him decide which one will best suit his n
    11·1 answer
  • Write an expression that executes the loop while the user enters a number greater than or equal to 0.
    10·1 answer
  • Interactive sites where users write about personal topic and comment to threaded discussion are called?
    10·2 answers
  • How are Action Buttons different than hyperlinks?
    8·1 answer
  • . is the language that Web pages are written in?(PHP,XML,HTML,Javascript)
    13·2 answers
  • What is a 96.1791 weighted gpa in a 4.0 scale?
    8·1 answer
  • HELP AASAP BRAINLIEST JUST HELP
    13·1 answer
  • Write a program to check the password( qbasic)​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!