Сортировка матрицы по убыванию суммы значений ее элементов, страница 5

for (g = 0; g < x; g++)

{

matrix_quick2[j][g] = matrix[t][g];

}

j++;

}

}

int counter_quicksort1 = 0;

int counter_quicksort2 = 0;

for (i = 0; i < counter_quick1 ; i++)

{

for (j = i+1; j < counter_quick1 ; j++)

{

if (quick1[i] < quick1[j])

{

temp=quick1[i];

quick1[i] = quick1[j];

quick1[j] = temp;

counter_quicksort1++;

for(int g = 0; g < x; g++)

{

temp_matrix = matrix_quick1[i][g];

matrix_quick1[i][g] = matrix_quick1[j][g];

matrix_quick1[j][g] = temp_matrix;

}

}

}

}

for (i = 0; i < counter_quick2 ; i++)

{

for (j = i+1; j < counter_quick2 ; j++)

{

if (quick2[i] < quick2[j])

{

temp=quick2[i];

quick2[i] = quick2[j];

quick2[j] = temp;

counter_quicksort2++;

for(int g = 0; g < x; g++)

{

temp_matrix = matrix_quick2[i][g];

matrix_quick2[i][g] = matrix_quick2[j][g];

matrix_quick2[j][g] = temp_matrix;

}

}

}

}

cout << "*** quick sort ***" << "\n" << "\n";

for(i = 0 ; i < counter_quick1 ; i ++)

{

for(j = 0; j < x ; j ++ )

{

cout << " " << matrix_quick1[i][j] << " ";

}

cout << endl;