title: scanf() giving wrong output for last line of input
body: <p>I am using scanf to take input for a graph. The input is as follows :</p>
  
  <pre><code>8
  1 2
  3 3 5 6
  2 4 7
  2 3 8
  2 1 5
  1 7
  2 6 4
  0
  </code></pre>
  
  <p>The first integer (8) is the number of vertices, followed by 8 line. The first integer in each is the number of outgoing edges from vertex 1 in the first line, vertex 2 in the second line and so on.</p>
  
  <p>The function i have written is as follows : </p>
  
  <pre><code>void getInput() {
      //init();
      int numVertex; int numTest;
  
      scanf("%d", &amp;numVertex);
      for(int i =1 ; i &lt;= numVertex;i++) {
          int ver,nC; vector&lt;int&gt; vList;
          //fscanf(file,"%d", &amp;ver);
          scanf("%d", &amp;nC);
  
          for(int j=0;j&lt;nC;j++) {
              int temp ;
              scanf("%d", &amp;temp);
              vList.push_back(temp);
  
          }
          props pr = {-1,-1 , vList};
          graph.insert(make_pair(i, pr) );
      }
  }
  </code></pre>
  
  <p>However, the output for the last line of my input becomes weird and it basically repeats the last digit of its previous line multiple times. For the above input , the output I am getting :</p>
  
  <pre><code>1 : 2
  2 : 3 5 6
  3 : 4 7
  4 : 3 8
  5 : 1 5
  6 : 7
  7 : 6 4
  8 : 4 4  // this is where it should give nothing
  </code></pre>
  
  <p>Can anyone tell me whats going wrong here? The exact same sequences of conversions, when I convert to taking input through file gives me the right output.</p>
  
  <p>Can someone please point me to any error?</p>