Question: Student Name Part 5 Writing a program (8 points) ou already learned how to write a program to count the number of words in a

 Student Name Part 5 Writing a program (8 points) ou already

Student Name Part 5 Writing a program (8 points) ou already learned how to write a program to count the number of words in a file. Can yow write a C program to count the occurrences of a fixed word in a string? So if the string s his is the last question.", and the word we need to count is "is", then the output should be 1. But notice that we do not need to count the substring "is in w The basic structure of program countWordc ord "This" below. In this program, the string is given in the main function and the fixed word to be counted should be entered by user. Please complete the program according to the comments. include # i nc lude int main(void) Library for io Library for string char str(1-This is the last question" char word [20]:/assume the smaximam length of each word is 20* step 1: get intput from user for the 'word" to be counted using scan step 2 get the length of the string "str and "word" respectively char curWord [201: a temporal string which is used to store the current word extracted from "str step 3 scan the "str" using a for lop and count the occurrences of the fixed word "word

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!