title: How do I iterate over cin line by line in C++?
body: <p>I want to iterate over <code>std::cin</code>, line by line, addressing each line as a <code>std::string</code>.  Which is better:</p>
  
  <pre><code>string line;
  while (getline(cin, line))
  {
      // process line
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>for (string line; getline(cin, line); )
  {
      // process line
  }
  </code></pre>
  
  <p>?  What is the normal way to do this?</p>