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

//                                            matrix_quick2[i][j] = matrix[i][j];

}

cout << endl;

}

cout << "\n";

//------------------------------ ñîçäàíèå ìàññèâîû ñóìì ñòðîê  -----------------------------------

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

{

massive[i] = 0;

select[i] = 0;

insert[i] = 0;

bubble[i] = 0;

shellk[i] = 0;

quick1[i] = 0;

quick2[i] = 0;

}

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

{

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

{

massive[i] += matrix[i][j];

select[i] += matrix[i][j];

insert[i] += matrix[i][j];

bubble[i] += matrix[i][j];

shellk[i] += matrix[i][j];

}

}

//------------------------------  ñîðòèðîâêà âûáîðîì ---------------------------------------------

counter = 0;

int temp = 0, g =0;

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

{

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

{

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

{

temp=select[i];

select[i] = select[j];

select[j] = temp;

counter++;

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

{

temp_matrix = matrix_select[i][g];

matrix_select[i][g] = matrix_select[j][g];

matrix_select[j][g] = temp_matrix;

}

}

}

}

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

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

{

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

{

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

}

cout << endl;

}

cout << "\n";

cout << "counter = " << counter << "\n"<<"\n";

//------------------------------ ñîðòèðîâêà âñòàâêàìè --------------------------------------------

counter = 0;

temp=0;