Write a program which takes a string and a word from theuser and search that wor
ID: 3615956 • Letter: W
Question
Write a program which takes a string and a word from theuser and search that word in the string and count how manytimes that word comes in the string. Note: program should search theword not a character.e.g:
#include<iostream.h> #include<stdio.h> voidcount(chr,char[]); voidmain() { charword,string[50]; puts(" Enter thestring:"); gets(string); puts(" Enter the wordyou want to search:"); gets(word); count(word,string); } void count(charword1,char string1[]) { .... .... .... .... .... cout<<"Theword "<<word<<" comes" << ............ <<"times in thestring"; } what should be thedefinition of the count function to count the given word in theprogram.Please write the red portion for the counting ofword. Note: program should search theword not a character.
e.g:
#include<iostream.h> #include<stdio.h> voidcount(chr,char[]); voidmain() { charword,string[50]; puts(" Enter thestring:"); gets(string); puts(" Enter the wordyou want to search:"); gets(word); count(word,string); } void count(charword1,char string1[]) { .... .... .... .... .... cout<<"Theword "<<word<<" comes" << ............ <<"times in thestring"; } what should be thedefinition of the count function to count the given word in theprogram.Please write the red portion for the counting ofword.