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
Luis saves an attachment that he received from Kevin. Where will the attachment save by default?
tia_tia [17]

Answer:

first one I do believe good luck with the answer

6 0
3 years ago
Which of the following can a cell contain?
Ksju [112]
The answer is choice D-All of these :)
8 0
3 years ago
Read 2 more answers
How do i delete a question ?
seraphim [82]

i think we can't do that

7 0
3 years ago
Ip address 10.10.20.0 255.255.255.224 how many host ip addresses are available in each subnet using this subnet mask?
Maksim231197 [3]
224 = 128 + 64 + 32, so that would mean each network could have 32 nodes. Subtract 2 for the network address and the multicast address, you would have 30 HOST addresses available.
3 0
4 years ago
What type of file system is used by blu-ray discs?
soldi70 [24.7K]

Answer:

Universal disc format (UDF) file system.

Explanation:

Blue-ray discs are the optical disc for data storage in a digital format. They were designed as succession of DVDs. They use UDF file system in them.

  • UDF file system is used in blu-ray discs.
  • This system is used to store data on discs by burning media.
  • These files have the extension (.UDF)
  • UDF is mostly used in DVDs and optical discs.
  • Broad range of data is stored in computer storage using UDF.
8 0
3 years ago
Other questions:
  • In three or four sentences, describe how a person buys and sells stock.
    6·2 answers
  • In Java, a char variable is capable of storing any Unicode character. Write a statement that assigns the Greek letter ^ to a cha
    7·1 answer
  • Retype the statements, correcting the syntax errors.
    9·1 answer
  • The algorithm ADDN implements N-bit fixed-width binary addition for non-negative integers and ignores overflows. For example, AD
    13·1 answer
  • Dummy activities A. are found in both AOA and AON networks. B. are used when two activities have identical starting and ending e
    9·2 answers
  • Why are some geo satellites not usually used for transmitting tcp/ip information?
    5·1 answer
  • Linux distributions automatically come with a native software firewall.TrueFalse
    13·1 answer
  • Complete the sentence.
    8·2 answers
  • Which word or phrase refers to an increasingly common method of computing and storing files?
    15·2 answers
  • Digital rights include the right to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!