This is a question i am working on: 

* Prompt the user to enter five numbers, being five people's weights. Store the numbers in a vector of doubles. Output the vector's numbers on one line, each number followed by one space.
* Also output the total weight, by summing the vector's elements.
* Also output the average of the vector's elements.
* Also output the max vector element.
So far this is the code i have

```
#include <iostream>
#include <vector>
using namespace std;

int main() {
   const int NEW_WEIGHT = 5;
   vector<float> inputWeights(NEW_WEIGHT);
   int i = 0;
   float sumWeight = 0.0;
   float AverageWeight = 1.0;
   int maxWeight = 0;
   int temp = 0;

   for (i = 0; i < NEW_WEIGHT; i++){
      cout << "Enter weight "<< i+1<< ": ";
      cout << inputWeights[i]<< endl; 
      cin>> temp;
      inputWeights.push_back (temp);

   }

   cout << "\nYou entered: ";

   for (i =0; i < NEW_WEIGHT- 1; i++) {

      cout << inputWeights.at(i)<< " ";
   }
   cout<< inputWeights.at(inputWeights.size() - 1) << endl;

   for (i =0; i < NEW_WEIGHT; i++){

       sumWeight += inputWeights.at(i); 

   }
   cout <<"Total weight: "<< sumWeight<< endl;

   AverageWeight = sumWeight / inputWeights.size();

   cout <<"Average weight: "<< AverageWeight<< endl;

   maxWeight= inputWeights.at(0);
   for (i =0; i < NEW_WEIGHT- 1; i++){
       if (inputWeights.at(i) > maxWeight){
          maxWeight = inputWeights.at(i);
       }
    }

    cout<< "Max weight: "<< maxWeight << endl;

    return 0;
}

```

When i run this code, whatever inputs i use(for the cin>>(...)), i get all zero's as output and i do not know why. can i get some help please.

**update**
cleaned up the code a little by getting rid of the **cout<< inputWeights[i]<< endl;**  

and by adjusting **vector inputWeights;** at the beginning of the program.But the outputs are still not exactly what they are supposed to be. Instead, only the first 2 inputted values make it as outputs. Any reason why? thanks 

**update this is the right or correct code. Hope it helps someone in future.** 

```
#include <iostream>
#include <vector>

using namespace std;

int main() {
   const int NEW_WEIGHT = 5;
   vector <float> inputWeights;
   int i = 0;
   float sumWeight = 0.0;
   float AverageWeight = 1.0;
   float maxWeight = 0.0;
   float temp = 0.0;

   for (i = 0; i < NEW_WEIGHT; i++){
      cout << "Enter weight "<< i+1<< ": "<< endl;
      cin>> temp;
      inputWeights.push_back (temp);

      }

      cout << "\nYou entered: ";

   for (i =0; i < NEW_WEIGHT- 1; i++){

      cout << inputWeights.at(i)<< " ";
   }
      cout<< inputWeights.at(inputWeights.size() - 1) << endl;

    for (i =0; i < NEW_WEIGHT; i++){

       sumWeight += inputWeights.at(i); 

      }
   cout <<"Total weight: "<< sumWeight<< endl;

       AverageWeight = sumWeight / inputWeights.size();

   cout <<"Average weight: "<< AverageWeight<< endl;

      maxWeight= inputWeights.at(0);
    for (i =0; i < NEW_WEIGHT- 1; i++){
       if (inputWeights.at(i) > maxWeight){
          maxWeight = inputWeights.at(i);
          }
    }

   cout<< "Max weight: "<< maxWeight << endl;

   return 0;
}

```