title: Counting the number of times a word appears in a file C++
body: <p>I am trying to search for a word in a file, and each time it appears it increases the count by 1.
  The file currently has multiple lines with the word <code>Culture</code> in it. The program outputs 1 for each time it runs. </p>
  
  <pre><code>int main()
  {
    fstream plate("data.txt", ios::in | ios::out | ios::app);
    int count = 0;
    string search = "Culture";
    string temp;
    while(!plate.eof())
      {
        getline(plate, temp);
        if(temp == search)
          {count++;}
      }
  
    cout &lt;&lt; count &lt;&lt; endl;    
  
    return 0;
  }
  </code></pre>
  
  <p>I don't see why it only outputs 1 every time</p>