This might be a bit of a noob question but let's say we have an integer vector with 40 elements. How could i use a for loop to iterate through the vector while adding the elements in groups of 10?
So the first 10 elements would be added and stored, then the next 10 elements, and so on?
I'm not sure what condition to use?
int sum;
for(int i = 0; i < vec.size(); i++)
{
if(some condition)
{
sum = vec[i] + sum;
}
}