title: Getline & cin.ignore in c++
body: <p>I know there are similar questions to mine, but I checked alot of them and didn't find the answer so I hope someone can help me.
  So what I am trying to do is store some strings into arrays, but some of these strings could consist of more than one word, so I searched the internet and found out I have to use <code>cin.ignore()</code> and <code>getline</code>. I used them, as seen in my code below, but the error happens in the second and third string where the first letter of <code>surname[0]</code> and <code>address[0]</code> is removed. So why is that?</p>
  <p>Here is my code:</p>
  <pre><code>int size;
  cout&lt;&lt;&quot;Please enter the number of entries&quot;&lt;&lt;endl;
  cin&gt;&gt;size;
  cin.ignore();
  string* firstname=new string[size];
  string* surname=new string[size];
  string* address=new string[size];
  cout&lt;&lt;&quot;First Name&quot;&lt;&lt;endl;
  for (int i=0;i&lt;size;i++)
      getline (cin, firstname[i]);
  cout&lt;&lt;&quot;Surname&quot;&lt;&lt;endl;
  cin.ignore();
  for (int i=0;i&lt;size;i++)
      getline (cin, surname[i]);
  cout&lt;&lt;&quot;Address&quot;&lt;&lt;endl;
  cin.ignore();
  for (int i=0;i&lt;size;i++)
      getline (cin, address[i]);
  for (int i=0;i&lt;size;i++)
  {
      cout&lt;&lt;&quot;First Name &quot;&lt;&lt;firstname[i]&lt;&lt;endl;
      cout&lt;&lt;&quot;Surname &quot;&lt;&lt;surname[i]&lt;&lt;endl;
      cout&lt;&lt;&quot;Age &quot;&lt;&lt;address[i]&lt;&lt;endl;
  }
  </code></pre>
  <p>EDIT: Sample Input/Output</p>
  <p><strong>Please enter the number of entries</strong></p>
  <p>4</p>
  <p><strong>First Name</strong></p>
  <p>John</p>
  <p>Michael</p>
  <p>Daniel</p>
  <p>Radu</p>
  <p><strong>Surname</strong></p>
  <p>Laaksonen</p>
  <p>Taro</p>
  <p>Albot</p>
  <p>Smith</p>
  <p><strong>Address</strong></p>
  <p>123 Larkin Street</p>
  <p>900 Larkin Street</p>
  <p>823 Larkin Street</p>
  <p>283 Larkin Street</p>
  <p>**First Name John</p>
  <p>Surname aaksonen</p>
  <p>Address 23 Larkin Street</p>
  <p>First Name Michael</p>
  <p>Surname Taro</p>
  <p>Address 900 Larkin Street</p>
  <p>First Name Daniel</p>
  <p>Surname Albot</p>
  <p>Address 823 Larkin Street</p>
  <p>First Name Radu</p>
  <p>Surname Smith</p>
  <p>Address 283 Larkin Street**</p>
  <p>Bold is the program's output. See how the L in Laaksonen is missing and the 1 in 123 is missing.</p>