title: How would I search each word of user input in a text file
body: <pre><code>char option;
  cout &lt;&lt;"What langauge would you like to translate from - English 'E' or French 'F': ";
  cin &gt;&gt; option;
  cin.ignore();
  
  ifstream in;
  in.open("Q3.dic");
  size_t pos;
  string phrase;
  if (option == 'E')
  {
      cout &lt;&lt;"please enter a sentence in English: ";
      getline(cin, phrase);
      for(string english, french; 
      getline(in, english, '\t') &amp;&amp; getline(in, french);
      )
      {
          pos = english.find(phrase);
          if(pos != string::npos)
          {
              cout &lt;&lt; french &lt;&lt;endl;
              break;
          }
      //cout &lt;&lt; english &lt;&lt; '\t' &lt;&lt; french &lt;&lt;endl;
      }
  }
  else if (option == 'F')
  {
      cout &lt;&lt;"please enter a sentence in French: ";
      getline(cin, phrase);
      for(string english, french; 
      getline(in, english, '\t') &amp;&amp; getline(in, french);
      )
      {
          pos = french.find(phrase);
          if(pos != string::npos)
          {
              cout &lt;&lt; english &lt;&lt;endl;
              break;
          }
      //cout &lt;&lt; english &lt;&lt; '\t' &lt;&lt; french &lt;&lt;endl;
      }
  }
  in.close();
  cout &lt;&lt;endl;
  
  system("pause");
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>Right now my code only works if I type only one word. But if I type in a sentence it won't ouput anything.</p>
  
  <p>So my question is if the user input: hello good morning,  How would I search for hello and good morning in my text file and output it. </p>
  
  <p>This is an example of the text file:</p>
  
  <p>today            aujourd'hui</p>
  
  <p>good             bon</p>
  
  <p>good morning         bonjour</p>
  
  <p>afternoon        après-midi</p>
  
  <p>good evening         bonsoir</p>
  
  <p>much             beaucoup</p>