#include
#include
#include
#include
using namespace std;
class reciprocal: unary_function {
public:
result_type operator()(argument_type i)
{
return (result_type) 1.0/i;
}
};
int main()
{
list l;
int i;
for(i=1; i<10; i++) l.push_back((double)i);
list::iterator p = l.begin();
p = transform(l.begin(), l.end(),l.begin(),reciprocal());
p = l.begin();
while(p != l.end()) {
cout << *p << " ";
p++;
}
return 0;
}