title: This while loop is hitting both outputs instead of just the one I expected
body: <p>So I've built a dictionary in a Binary Search Tree where the user should be able to look up a word in the program which will be retrieved from a .txt file and displayed with its definition.</p>
  
  <p>I'm using a keyword function to search the first word of each line, when the right word is found the function gets the whole line and displays it.  </p>
  
  <p>Here's the issue, if I search for a word not in the dictionary the function outputs "word not found" like I would expect.  However, anytime I search a word that is in the file I get both the word/def output AND the "word not found" message that I only want to appear if there was no match.</p>
  
  <p>Here is where the keyword function is called:</p>
  
  <pre><code>case 1:
              cout &lt;&lt; "\nEnter the word that you would like to look up:" &lt;&lt; endl;
              cin &gt;&gt; word;
              wordFile.open("dictionaryWords.txt");
              B.Keyword(wordFile , word);
              wordFile.close();
  
              cout &lt;&lt; endl;
  
              break;
  </code></pre>
  
  <p>and here is the keyword function with the while loop in question.</p>
  
  <pre><code>void BSTree::Keyword(fstream &amp; wordFile, string word) {
      string def;
      while (getline(wordFile, def)) {
          if (def.find(word) != string::npos)
          {
              cout &lt;&lt; def &lt;&lt; endl;
          }
      }
      cout &lt;&lt; word &lt;&lt; " not found" &lt;&lt; endl;
  }
  </code></pre>