1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
#include <algorithm>
int main()
{
const size_t N = 5;
int a[N];
int b[N];
int array[2 * N]= { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
std::copy( array, array + N, a );
std::for_each( a, a + N, []( int x ) { std::cout << x; } );
std::cout << std::endl;
std::copy( array + N, array + 2 * N, b );
std::for_each( b, b + N, []( int x ) { std::cout << x; } );
std::cout << std::endl;
for( size_t i=0; i < N; i++ )
{
std::cout << a[i] << " " << b[i] << "\n";
}
return 0;
}
|