Sort a matrix by the sum of the rows C++ : Heyy, I am new to programming, so can you help me finish my program? I have to sort the matrix by the sum of the rows, the smallets sum has to be first and the the bigger and at the end has to be the biggest sum.
I have done this but I cant finish it:





    #include <iostream>

using namespace std;

int main ()

{
  int **matrix;

  int i, j, count, row, col, sum, temp;


  cout << "\n Enter the number of rows and columns";

  cin >> row >> col;

  matrix = new int *[row];

  for (count = 0; count < row; count++)

    matrix[count] = new int[col];

  cout << "\nNow enter the element for the matrix.";

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

    {

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

	{

	  cout << "\nRow " << (i + 1) << " Col " << (j + 1) << " :";

	  cin >> *(*(matrix + i) + j);

	}

    }

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

    {

      sum = 0;
      for (j = 0; j < col; j++)
	sum = sum + matrix[i][j];
      cout << sum << endl;
    }
    
  for (int count = 0; count < row; count++)

    delete[]matrix[count];

   delete[]matrix;

   matrix = 0;

  return 0;
}


