How do I iterate over cin line by line in C++?
<p>I want to iterate over cin, line by line, addressing each line as a std::string.  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>
