Why is cout printing twice when I use getline?
<p>I'm trying to read in a string of text using getline.  For some reason, it prints 'Please enter your selection' twice:</p>

<pre><code>Please enter your selection
Please enter your selection
</code></pre>

<p>If I key invalid text, it loops again, and only prints the one time each loop thereafter.</p>

<pre><code>while (valid == false) {    
    cout &lt;&lt; "Please enter your selection" &lt;&lt; endl;
    getline (cin,selection);

    // I have a function here which checks if the string is valid and sets it to true 
    // if it is valid.  This function works fine, so I have not included it here.  The while
    // look breaks correctly if the user enters valid input.
}
</code></pre>

<p>Does anybody have any idea why this may be occurring?</p>

<p>Thank you</p>
