title: istream::ignore and getline() confusion
body: <p>I am helping someone with C++ input even though I don't know C++ myself. Here's a short example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main() {
      int i;
      string s;
  
      cout &lt;&lt; "enter i:\n";
      cin &gt;&gt; i;
      cout &lt;&lt; "enter s:\n";
      getline(cin, s);
      //cin.ignore(100, '\n');
      cout &lt;&lt; "i: " &lt;&lt; i &lt;&lt; ", s: " &lt;&lt; s &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>As expected, the <code>getline()</code> call will not prompt the user for input because it will simply swallow the trailing <code>\n</code> after the <code>cin &gt;&gt; i</code> call and return immediately. What I find odd is that if you uncomment the <code>cin.ignore()</code> call, the <code>getline()</code> call <strong>will</strong> prompt the user for input (even though nothing will be saved into <code>s</code>). Could someone explain why? In my view, the line in question should not change the behaviour at all.</p>