title: Counting the number of words in a string, C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3672234/c-function-to-count-all-the-words-in-a-string">C++ function to count all the words in a string</a>  </p>
  </blockquote>
  
  
  
  <p>So I have a line of words which i stored in a string using C++. i.e. "There was a farmer named Billy\n"</p>
  
  <p>I want to know the number of words in the string (i.e. There are currently 6 words in it). Can  anyone tell me how to do this? If this is not possible is there a way I can count the number of spaces in the string (i.e. " "). Let me know THanks!</p>