#include #include #include #include using namespace std; int main() { int ia[] = {1, 2, 5, 10}; vector iv(ia, ia + 4); vector ov(iv.size()); adjacent_difference(iv.begin(), iv.end(), ov.begin()); copy(ov.begin(), ov.end(), ostream_iterator(cout, " ")); cout << '\n'; adjacent_difference(iv.begin(), iv.end(), ov.begin(), minus()); copy(ov.begin(), ov.end(), ostream_iterator(cout, " ")); cout << '\n'; } /* Displays: 1 1 3 5 1 1 3 5 */