title: Loading words from a text file to a map in c++
body: <p>I am trying to make a program which counts the times specific words appear in a text. The list of words will be in one text file, and the text will be in another. The words and the amount of words in the list is unknown. My plan is to make the word list into a map in a <code>map&lt;string,int&gt;name</code> style with the different words as the keys an then increase the value by one in the map.</p>
  
  <p>Here is an example:</p>
  
  <p>File.txt:</p>
  
  <pre><code>This is the text the program will analyze with the other file. Fun stuff.
  </code></pre>
  
  <p>List.txt:</p>
  
  <pre><code>the
  other
  normal
  </code></pre>
  
  <p>And the expected outcome when you run the program is:</p>
  
  <pre><code>name[the] = 3
  name[other] = 1
  name[normal] = 0
  </code></pre>
  
  <p><strong>The main problem I need help to solve is how to make a map from the words in a text file.</strong> I can probably sort out the other stuff myself. I obviously cant show you any of my code because I need to sort this out before I can even start.</p>
  
  <p>Also, this is not an assignment, so I am free to do it in any other way. Please tell if you know about a more efficient way to do this!</p>