title: find average of input to vector c++
body: <p>I am trying to write a program where the user inputs as many numbers as they want and then the program returns the average of the numbers. So far the program only outputs the last number entered.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;numeric&gt;
  
  
  using namespace std;
  
  int main()
  {  
      vector&lt;float&gt; v;
      int input;
  
      cout &lt;&lt; " Please enter numbers you want to find the mean of:" &lt;&lt;endl;
      while (cin &gt;&gt; input);
      v.push_back(input);
  
  float average = accumulate( v.begin(), v.end(), 0.0/ v.size());
  cout &lt;&lt; "The average is" &lt;&lt; average &lt;&lt; endl;
  
  return 0;  
  
  }
  </code></pre>