title: Getline jump on next cin and skip the previous cin
body: <p>I am trying to use getline() but after enter the 1st record cursor don't wait for 2nd country name it skip and jump on capital name. Where is my mistake. If I enter </p>
  
  <p>Country: India<br>Capital:Delhi<br> Capita: 57382 <br> it take these value without any issue but cursor doesn't wait for next Country it directly jumps on Capital after entering the capita value.</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  #include &lt;string.h&gt;
  struct country
  {
  char nm[30];
  char capital[30];
  float income;
  };
  
  void main()
  {
    country c[5];
    clrscr();
    for( int i=0; i&lt;5 ; i++)
    {
      cout &lt;&lt; "\n Country's name : ";
      cin.getline(c[i].nm, 30);
      cout &lt;&lt; "\n Country's capital :";
      cin.getline(c[i].capital,30);
      system("cls");
      cout &lt;&lt; "\n Per capita income :";
      cin &gt;&gt; c[i].income;
    }
  </code></pre>
  
  <p>I modified the code by adding cin.ignore();</p>
  
  <pre><code>  for( int i=0; i&lt;5 ; i++)
    {
      cout &lt;&lt; "\n Country's name : ";
      cin.getline(c[i].nm, 30);
      cin.ignore();
      cout &lt;&lt; "\n Country's capital :";
      cin.getline(c[i].capital,30);
      cin.ignore();
      cout &lt;&lt; "\n Per capita income :";
      cin &gt;&gt; c[i].income;
      cin.ignore();
    }
  </code></pre>
  
  <p>But after this getline() waits for next Country but it is now waiting after each entry of Country, Capital and Capita. Means I enter <br></p>
  
  <blockquote>
    <p>Country:India //Press enter //waiting and I pressed enter here<br>
    Capital:Delhi //Press enter //waiting and I pressed enter here <br>Capita:
    32323 //Press enter //waiting and I pressed enter here</p>
  </blockquote>
  
  <p>Same for 5 times.</p>