title: Why getline skips first line?
body: <p>In the following code, <code>getline()</code> skips reading the first line.
  I noted that when commenting the "<code>cin &gt;&gt; T</code>" line, it works normally. But I can't figure out the reason.</p>
  
  <p>I want to read an integer before reading lines! How to fix that?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main () {
      int T, i = 1;
      string line;
  
      cin &gt;&gt; T;
  
      while (i &lt;= T) {
          getline(cin, line);
          cout &lt;&lt; i &lt;&lt; ": " &lt;&lt; line &lt;&lt; endl;
          i++;
      }
  
      return 0;
  }
  </code></pre>