title: I am trying to fill vector array with getline, what's wrong?
body: <p>I would like to fill a vector array with some lines but I don't get the same back. What is the problem with my code?</p>
  
  <pre><code>using namespace std;
  
  vector&lt;string&gt; calling(int n){
      vector&lt;string&gt; file(n);
      int a=0;
  
      while(n){
         getline(cin,file[a]);
         cin.ignore();
         a++;
         n--;
      }
      return file;
  }
  
  int main() {
      int n;
      cin &gt;&gt; n;
      vector&lt;string&gt; hrml = calling(n);
      int a=0;
      while(n){
          cout &lt;&lt; hrml[a] &lt;&lt;endl;
          a++;
          n--;
       }
       return 0;
  }
  </code></pre>
  
  <p>The input: </p>
  
  <pre><code>3
  aaaa aaa aa
  bb b bbbb
  c cc ccc
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>aaaa aaa aa
  bb b bbbb
  </code></pre>