The first assignment can be done the following way
1 2 3 4 5 6 7 8
constint N = 4;
int initial_value = 3;
for ( int i = 0; i < N; i++ )
{
iota_n( std:ostream_iterator<int>( std::cout, " " ), N, initial_value++ );
std::cout << std::endl;
}:
So all you need is to write algorithm iota_n yourself.
The second assignment can be done the following way
1 2 3 4 5 6 7 8
constint N = 4;
int initial_value = 3;
for ( int i = 0; i < N; i++ )
{
iota_n( std:ostream_iterator<int>( std::cout, " " ), i + 1, initial_value++ );
std::cout << std::endl;
}:
The third assignment can look as
1 2 3 4 5 6 7 8
constint N = 4;
int initial_value = 3;
for ( int i = 0; i < N; i++ )
{
iota_n( std:ostream_iterator<int>( std::cout, " " ), N - i, initial_value++ );
std::cout << std::endl;
}:
The forth assignment can be done as
1 2 3 4 5 6 7 8
constint N = 4;
int initial_value = 6;
for ( int i = 0; i < N; i++ )
{
iota_n( std:ostream_iterator<int>( std::cout, " " ), i + 1, initial_value );
std::cout << std::endl;
}: