title: Find longest word in txt file with C++
body: <p>I have a .txt file that looks like this:</p>
  
  <pre><code>bear
  cat
  wolf
  mouse
  tiger
  elephant
  rat
  </code></pre>
  
  <p>I need to write a simple loop that reads my txt file and outputs the longest word. How would I go about this?</p>
  
  <p>Edit The problem I am having is going through each line in the file.                       </p>
  
  <pre><code>biggestword="o";
  
  while (i=0;i&lt;linesinfile;i++) {
      if (currentword.length&gt;biggestword.length) {
          biggestword = currentword;
      }
  }
  </code></pre>