#include <algorithm>
#include <functional>
#include <cstdlib>
#include <vector>
#include <iostream>
using namespace std;
template <class T>
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}
int main( )
{
vector<int> random( 8 );
generate( random.begin(), random.end(), rand );
print( random);
transform( random.begin(), random.end(), random.begin(),bind2nd( modulus<int>(), 6 ) );
print( random );
}
|