#include #include int main(){ std::vector a{1.0, 2.0, 3.0, 4.0, 5.0}; double sum = 0; a[1] = 2.2; for(auto el: a){ std::cout << el << std::endl; sum += el; } std::cout << "Sum = " << sum << std::endl; // 15.2 return 0; }