Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This is the answer of Exercise #9: No for-loops.
Replace the for-loop. You will need:
const int Product(const std::vector<int>& v)
{
{
product*=v[i];
}
return product;
}
const int Product(const std::vector<int>& v)
{
return std::accumulate(v.begin(),v.end(),1,std::multiplies<int>());
}
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.