#include "iostream" #include "stdlib.h" #include "iomanip" using namespace std; int main() { setlocale(LC_CTYPE,"Russian"); int size; cout << "Введите размер массива "; cin >> size; int *a = new int[size]; cout << "Введите элементы массива \n" ; for (int i = 0; i < size; i++) { cin >> a[i]; } for (int i = 0; i < size; i+=2) { if(a[i]>0) { int minIndex = i; for (int j = i + 2; j < size; j += 2) { if (a[j] < a[minIndex]) { minIndex = j; } } swap (a[i], a[minIndex]); } } cout <<"Вывод массива \n"; for (int i = 1; i < size; i += 2) { cout << a[i] << ' '; } system ("pause"); return 0; }