#include #include #include #include using std::cout; using std::vector; template void print( const T& value ) { cout << value << " "; } int main() { srand( unsigned( time( NULL ) ) ); vector vecI; for ( int i = 1; i <= 7; ) { int num = rand() % 39 + 1; if ( find( vecI.begin(), vecI.end(), num ) == vecI.end() ) { vecI.push_back( num ); ++i; } } sort( vecI.begin(), vecI.end() ); for_each( vecI.begin(), vecI.end(), print ); }