title: getline() function is skipping inputs
body: <p>I have the following code that does some tests on nomC and nomP, but using 2 successive getlines causes skipping the the first one (getline(cin,nomP); ) .. how can i fix the problem ? PS : i tried cin.ignore(); and cin.clear(); and it didn't work</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;vector&gt;
  #include&lt;string&gt;
  using namespace std;
  
  int main()
  {
      int T;
      cin &gt;&gt; T;
      vector&lt;string&gt; decision(T);
      for(int i=0;i&lt;T;i++)
      {
           string nomP,nomC;
          string help="";
          vector&lt;string&gt; desc;
          bool accepted = true;
          getline(cin,nomP);
          getline(cin,nomC);
          while(help!="----")
          { getline(cin,help); desc.push_back(help);}
          if ((nomP.size()&lt;5)|| (nomP.size()&gt;20))
            {decision[i] = nomC+" rejected with error code 1.\n";accepted=false;}
          if (nomP[0]&lt;65|| nomP[0]&gt;90)
              {decision[i] = nomC+" rejected with error code 2.\n";accepted=false;}
          if (nomP[nomP.size()]==32)
              {decision[i] = nomC+" rejected with error code 3.\n";accepted=false;}
          if((nomC.size()&lt;5)|| (nomC.size()&gt;10))
              {decision[i] = nomC+" rejected with error code 4.\n";accepted=false;}
          for(int j=0;j&lt;nomC.size();j++)
          {
              if(((nomC[j]&lt;48)&amp;&amp;(nomC[j]&gt;57))||((nomC[j]&lt;97)&amp;&amp;(nomC[j]&gt;122)))
              {decision[i] = nomC+" rejected with error code 5.\n";accepted=false;break;}
          }
          if (desc.size()&gt;10)
              {decision[i] = nomC+" rejected with error code 6.\n";accepted=false;}
          for(int j=0;j&lt;desc.size();j++)
          {
              if((desc[j].size()&lt;1)||(desc[j].size()&gt;80))
              {decision[i] = nomC+" rejected with error code 7.\n";accepted=false;break;}
          }
          if (accepted)
              decision[i] = nomC+" is OK.\n";
      }
      for (int i=0;i&lt;decision.size();i++)
      {
          cout&lt;&lt; decision[i] &lt;&lt; endl;
      }
  return 0;
  }
  </code></pre>