title: While loop comparing size instead of amount
body: <p>I am trying to create a while loop that takes 'x' amount of integers the user wants (<code>total</code>), and then keep looping until the user inputs all of the integers. When the user inputs the <code>total</code>, the while loop has a comparison but it doesn't work (I'm aware of this, but I don't know how to fix it). If the <code>total</code> is bigger than <code>numbers</code>, it exits the loop. I want it to loop until the chosen number (by the user) of integers is inputted!</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;numeric&gt; //for accumulate
  
  
  int sumUpTo(const std::vector&lt;int&gt;&amp; vec, const std::size_t total) //const prevents parameters to not be modified in function.
  {
      if (total &gt; vec.size())
          return std::accumulate(vec.begin(), vec.end(), 0);
  
      return std::accumulate(vec.begin(), vec.begin() + total, 0);
  }
  
  
  int main() {
  
      
      std::vector &lt;int&gt; storage;
      int total = 0, numbers = 0;
  
      std::cout &lt;&lt; &quot;Please enter the amount of numbers you want to input\n&quot;;
      std::cin &gt;&gt; total;
      std::cout &lt;&lt; &quot;Now enter your numbers\n&quot;;
      std::cin &gt;&gt; numbers;
      
      while (numbers &lt; total) {
          std::cin &gt;&gt; numbers;
  
  
              storage.push_back(numbers); //takes user input (numbers) and pushes them into the vector (storage).
      }
  
      sumUpTo(storage, total);
  
  
      return 0;
  }
  </code></pre>