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
. Convert your age into binary and then to hexadecimal. Show your work.
Dovator [93]

Explanation:

Age = 23.

To convert a base 10 number to hexadecimal number we have to repeatedly divide the decimal number by 16 until  it becomes zero and store the remainder in the reverse direction of obtaining them.

23/16=1 remainder = 5

1/16=0 remainder = 1

Now writing the remainders in reverse direction that is 15.

My age in hexadecimal number is (15)₁₆.

5 0
4 years ago
Need ASAP
expeople1 [14]
The customer should consider buying the hard drive
3 0
3 years ago
____________ markup languages contain sets of directions that tell the browser software how to display and manage a web document
alekssr [168]
Hyper Text Markup Language (HTML).
5 0
4 years ago
How to cancel branly subscription??​
Vlad [161]

Answer:

cancel subscription

Explanation: website

3 0
4 years ago
An operating system coordinates the BLANK of a computers operation.
devlian [24]
I believe it is D. The Central Processing Unit (CPU) can manage memory and storage. It also makes sure every program has what it needs to keep it up and running. 
8 0
3 years ago
Read 2 more answers
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • If a method writes to a file it should start out like (fill out the blank, what should you write after the parameters in the met
    12·1 answer
  • What should you keep in mind when typing a message on the Internet?use as many A.acronyms as it saves space
    7·1 answer
  • A(n _______________ is a pre-written formula that is built into excel
    12·1 answer
  • Function countValues = CreateArray(endValue) % endValue: Ending value of countValues
    7·1 answer
  • What is an important step to take before entering your first data into your database?
    10·2 answers
  • (Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number o
    8·1 answer
  • Your Google Search text ad has three main components. The first is a headline, and the second is a description. What's the third
    14·1 answer
  • 2.11 (Separating the Digits in an Integer) Write a script that inputs a five-digit integer from the user. Separate the number in
    12·1 answer
  • A location in memory which stores a value, the value can change as the program is running is
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!