title: Basic String input
body: <p>I've just came across this bit of code that allows users to input strings in the command prompt. I'm aware of what they do and it's all great. But I have a question in regards to the cin and getline() functions.</p>
  
  <pre><code>string name ;
  cout &lt;&lt; "Please enter your full name: " ;
  cin &gt;&gt; name ;
  cout &lt;&lt; "Welcome " &lt;&lt; name &lt;&lt; endl ;
  cout &lt;&lt; "Please enter your full name again please: " ;
  getline(cin , name) ;
  cout &lt;&lt; "That's better, thanks " &lt;&lt; name &lt;&lt; endl ;
  return 0 ;
  </code></pre>
  
  <p>Now when this is output, I get something along the lines of: (using john smith as the input)</p>
  
  <pre><code>Please enter your full name: john smith
  Welcome John
  Please enter your full name again: That's better thanks Smith
  </code></pre>
  
  <p>I understand why this happens, the getline is still reading from the input buffer and I know how to fix it. My question is, why is there no newline coming after the "Please enter your full name again: "? When I alter the code to:</p>
  
  <pre><code>string name ;
  cout &lt;&lt; "Please enter your full name: " ;
  cin &gt;&gt; name ;
  cout &lt;&lt; "Welcome " &lt;&lt; name &lt;&lt; endl ;
  cout &lt;&lt; "Please enter your full name again please: " ;
  cin.ignore( 256, '\n') ;
  getline(cin , name) ;
  cout &lt;&lt; "That's better, thanks " &lt;&lt; name &lt;&lt; endl ;
  return 0 ;
  </code></pre>
  
  <p>Suddenly I get a newline after you enter your full name again. It's not really a huge issue to be honest. But I wouldn't mind knowing what happened if anyone can help me. Thanks!</p>