Counting word occurences
You cannot use double quotes in a string literal like this:


cout &lt;&lt; "Enter some text. Type "***" to end." &lt;&lt; endl;



(The syntax-highlighting even changes the color of the ***.)

In order to print them out, you have to escape them as such:

cout &lt;&lt; "Enter some text. Type \"***\" to end." &lt;&lt; endl;


I suppose your compiler ignored the original, as I got an error when I tried it.

See this for more info on escape sequences in C++.