title: Getting Word Frequency From Vector In c++
body: <p>I have googled this question and couldn't find an answer that worked with my code so i wrote this to get the frequency of the words the only issue is that i am getting the wrong number of occurrences of words apart form one that i think is a fluke. Also i am checking to see if a word has already been entered into the vector so i don't count the same word twice.   </p>
  
  <pre><code>fileSize = textFile.size();
  vector&lt;wordFrequency&gt; words (fileSize);
  int index = 0;
  for(int i = 0; i &lt;= fileSize - 1; i++)
  {
      for(int j = 0; j &lt; fileSize - 1; j++)
      {
          if(string::npos != textFile[i].find(textFile[j]) &amp;&amp; words[i].Word != textFile[j])
          {
              words[j].Word = textFile[i];
              words[j].Times = index++;
          }
      }
      index = 0;
  }
  </code></pre>
  
  <p>Any help would be appreciated. </p>