trnsfrm1.cpp

trnsfrm1.cpp

#include ‹stl.h›

#include ‹iostream.h›

int negate_int(int a_) {

 return -a_;

}

int numbers[6] = {-5, -1, 0, 1, 6, 11};

int main() {

 int result[6];

 transform(numbers, numbers + 6, result, negate_int);

 for (int i = 0; i ‹ 6; i++) cout ‹‹ result[i] ‹‹ ;

 cout ‹‹ endl;

 return 0;

}