Explanation:- c++ word frequency counter is different from the counting the character in a string, as we know that the words are a group of two or more character and words are separated from white space so we have to count the total number of words in a string.
So basically idea is to count the characters between two spaces in a given string or sentence, from starting to next space counter will be 1 and for next space to next to next space increase the counter by one now counter is two and so on until program reached to second last space to NULL character in string or sentence.
Output:
Please Enter A String:
c++ programming
2
need an explanation for this answer? contact us directly to get an explanation for this answer