Ответы и объяснения

2013-05-28T12:53:32+00:00

#include <iostream>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <cstdlib>
using namespace std;
const int SIZE = 20;
int arr[SIZE] = { -1, 1, 5, 2, -4, 0, 7, -2, 5, -9, 3,6,-9,0,-4,4,6,2,13,5 };
void Massiv()
{
cout << "new Array:" << std::endl;
copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));
cout << std::endl;

int first= arr[0];
int second=arr[1];
for (int k=0;k<SIZE-2;k++)
arr [k]=arr[k+2];
arr[SIZE-2]=first;
arr [SIZE-1]=second ;
cout << "new Array:" << std::endl;
copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));
cout << std::endl;}

 

int main()
{
Massiv();

system("pause");
return 0;
}