В C++ работает этот код. Других языков практически не знаю.
#include
int main()
{
using namespace std;
const int n = 8;
double Arr[n] = { 122.3, 11.4, -34.2, 17.8, -25.5, -54, 34, -43};
for (int i = 0; i < n; ++i)
cout << Arr[i] << " ";<br> cout << endl;<br>
double max, min;
for (int i = 0; i < n; ++i)
{
if (Arr[i] < 0)
{
int inegmax = i;
for (int j = i; j < n; ++j)
if (Arr[j] < 0)
if (Arr[j] >= Arr[inegmax])
inegmax = j;
max = Arr[inegmax];
Arr[inegmax] = Arr[i];
Arr[i] = max;
}
else
{
int iposmin = i;
for (int j = i; j < n; ++j)
if (Arr[j] >= 0)
if (Arr[j] < Arr[iposmin])
iposmin = j;
min = Arr[iposmin];
Arr[iposmin] = Arr[i];
Arr[i] = min;
}
}
for (int i = 0; i < n; ++i)
cout << Arr[i] << " ";<br> cout << endl;<br> return 0;
}