https://pastein.ru/t/Hd

  скопируйте уникальную ссылку для отправки


#include <iostream>

#include <vector>

using namespace std;



int main()

{
	int* b = new int[1000]{};
	int n = 7;
	int* a = new int[n] {96,38,225,7,12,324,110};
	int r, s;
	r = a[0];
	s = a[0];

	for (int i = 0; i <n; i++)
	{
		cout << a[i] << endl;

	}
	cout << endl;
	cout << endl;
	cout << endl;

	for (int i = 1; i < n; i++)
	{
		if (r > a[i])
		{
			r = a[i];
		}
		else
			if (s < a[i])
				s = a[i];
	}
	cout << r << "   " << s<<endl;
	cout << endl;
	cout << endl;
	cout << endl;
	for ( int i = r;  i <= s;  i++)
	{
		
		b[i] = s + 1;
	}

	for (int i = 0; i < n; i++)
	{
		b[a[i]] = a[i];
	}	

	int k = 0;
	for (int i = r; i <= s; i++)
	{
		if (b[i] != s + 1)
		{
			
			a[k] = b[i];
			k++;
		}

	}


	for (int i = 0; i < n; i++)
	{
		cout << a[i]<<endl;

	}

}