title: String Input error when using stringstream and if-else statement
body: <p>I am trying to write a part of a large code where a string of 2 numbers is inputted by the user and each number is parsed from the string to do simple addition (just wanted to test the parsing for now).</p>
  
  <p>I do the parsing using stringstream which seems to work but using this code to compute multiple cases is not working. Please see code and output below;</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  
  int main()
  {
   int t;
  
   std::cout &lt;&lt; "Enter the number of test cases: ";
   std::cin &gt;&gt; t;                                     
   std::cout &lt;&lt; std::endl;                                
  
   if (t &gt; 10 || t &lt; 1)                                   
   {
    std::cout &lt;&lt; "Invalid number of test cases!" &lt;&lt; std::endl;                
    return 0;
   }
   else                                           
   { 
  
    for (int x = 0; x &lt; t; x++)                               
    {   
    std::stringstream numbers;
    int num_1;
    int num_2;
  
    std::cout &lt;&lt; "Enter the two numbers (separated by a space): " &lt;&lt; std::endl;       
    std::string input;
  
    getline (std::cin, input);                                
  
    numbers &lt;&lt; input;                                 
  
    numbers &gt;&gt; num_1 &gt;&gt; num_2;                                
  
    std::cout &lt;&lt; num_1 &lt;&lt; std::endl;                          
    std::cout &lt;&lt; num_2 &lt;&lt; std::endl;                          
    std::cout &lt;&lt; num_1 + num_2 &lt;&lt; std::endl;                      
    }
  }
  
   return 0;
  
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/FtGuO.png" rel="nofollow">Code Output</a></p>
  
  <p><strong>CODE OUTPUT</strong></p>
  
  <pre><code>Enter the two numbers (separated by a space):
  0
  -13120
  -13120
  
  Enter the two numbers (separated by a space):
  1 3
  1
  3
  4
  
  Enter the two numbers (separated by a space):
  4 5
  4
  5
  9
  
  Enter the two numbers (separated by a space):
  6 7
  6
  7
  13
  </code></pre>
  
  <p>Why is the first case not taking inputs?</p>