title: How to read in multiple words from a text file?
body: <p>I have a question about file input in c++. I want to be able to create a string variable and read in a SENTENCE from the file. How would I do this? This is the code I have so far.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
  string word;
  ifstream fin;
  
  // Open the file
  fin.open("file.txt");
  
  // Read in the sentence from the file
  fin &gt;&gt; word;
  
  cout &lt;&lt; word &lt;&lt; endl;
  
  return 0;
  }
  </code></pre>
  
  <p>The problem is, when I try to read in a sentence from the file, it only reads in a word and not the sentence.</p>
  
  <p>So if I had a sentence in a textfile (assuming that there is no line break) it would only print out the single word.</p>
  
  <p>How would I fix this?</p>