I can't figure out how to use for loop to access the vector's elements to find the average. I tried to look for a solution, but I couldn't find anything. The little piece of code that I wrote doesn't seem like the solution.
#include <iostream>
#include <vector>
using namespace std;
int main() {
const int VALS_SIZE = 6;
vector<int> valsVctr(VALS_SIZE);
unsigned int i;
int sumVal;
int avgVal;
valsVctr.at(0) = 30;
valsVctr.at(1) = 20;
valsVctr.at(2) = 20;
valsVctr.at(3) = 15;
valsVctr.at(4) = 5;
valsVctr.at(5) = 10;
sumVal = 0;
avgVal = 0;
/* FIXME: Write for loop to iterate through vector */
for(int i = 0; i < 7;i++)
valsVctr[i] = i+1;
avgVal = sumVal / VALS_SIZE;
cout << "Avg: " << avgVal << endl;
return 0;
}