sum of vector c++

C++
accumulate(a.begin(), a.end(), 0);
Source

Also in C++: