Т.к. a и b были не заданы, взял с 0 по size.
#include <iostream> #include <array> #include <algorithm> #include <numeric> constexpr std::size_t SIZE = 11u; int main() { std::array<int, SIZE> b{ -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }; std::array<int, SIZE> c; std::transform(b.begin(), b.end(), c.begin(), [](int const& x) { return x; }); std::cout << std::accumulate(c.begin(), c.end(), 0); }