#include <iostream> // cout #include <algorithm> // generate_n using namespace std; int current = 0; int UniqueNumber () { return ++current; } int main () { int myarray[9]; generate_n (myarray, 5, UniqueNumber); cout << "myarray contains:"; for (int i=0; i<9; ++i) cout << ' ' << myarray[i]; cout << ' '; return 0; }