adjdiff0.cpp

We use cookies. Read the Privacy and Cookie Policy

adjdiff0.cpp

#include ‹stl.h›

#include ‹iostream.h›

int numbers[5] = {1, 2, 4, 8, 16};

int main() {

 int difference[5];

 adjacent_difference(numbers, numbers + 5, difference);

 for (int i = 0; i ‹ 5; i++) cout ‹‹ numbers[i] ‹‹ ;

 cout ‹‹ endl;

 for (i = 0; i ‹ 5; i++) cout ‹‹ difference[i] ‹‹ ;

 cout ‹‹ endl;

 return 0;

}