#include
#include
#include
using namespace std;
double reciprocal(double i) {
return 1.0/i;
}
int main()
{
list listObject;
int i;
for(i =1; i < 10; i++)
listObject.push_back((double)i);
cout << "Original contents of listObject:\n";
list::iterator p = listObject.begin();
while(p != listObject.end()) {
cout << *p << " ";
p++;
}
cout << endl;
// transform listObject
p = transform(listObject.begin(), listObject.end(), listObject.begin(), reciprocal);
cout << "Transformed contents of listObject:\n";
p = listObject.begin();
while(p != listObject.end()) {
cout << *p << " ";
p++;
}
return 0;
}