8
double average(std::vector<int> v) {
9
return std::accumulate(v.begin(),v.end(),0.0)/v.size();
12
std::vector<double> half(const std::vector<double>& v) {
13
std::vector<double> w(v);
14
for (unsigned int i=0; i<w.size(); i++)
19
void halve_in_place(std::vector<double>& v) {
20
// would you believe this is the same as the above?
21
std::transform(v.begin(),v.end(),v.begin(),
22
std::bind2nd(std::divides<double>(),2.0));