#include #include #include int main() { std::vector v{1.0,2.0,3.0}; double prod=1.0; std::for_each(v.begin(),v.end(), [&prod] (double x) { prod *= x;}); std::cout <<"product = "<< prod << "\n"; }