Answers for "c++ product of vector"

C++
0

c++ product of vector

#include <functional> // multiplies
#include <numeric> // accumulate
// ...
std::vector<int> v {2,3,4};
int result = std::accumulate(v.begin(), v.end(), 1, std::multiplies<int>());
Posted by: Guest on February-19-2021

Browse Popular Code Answers by Language