Muhd
0
Q:

sum elements in vector c++

accumulate(a.begin(), a.end(), 0);
4
accumulate(a.begin(), a.end(), 0)
4
for (auto& n : vector)
    sum_of_elems += n;
0

New to Communities?

Join the community