title: Bubble sorting 2d array
body: <p>I am trying to sort a 2d Array using bubble sort algorithm and i am constantly failing. What i need to do is to create a 2d array of random numbers 10-90 and find out the largest elements from each row after that sort that list of largest elements in ascending order using Bubble sort. I have done until finding the largest element from each row but i can not sort that list. The list of largest elements is saved in a variable called max. How can i sort that list using bubble sort. 
  Any help will be appreciated. </p>
  
  <p>Below is what I have tried so far:</p>
  
  <p>//Write a program that fills the values of the two dimensional array A[N,M] with the random numbers from 10 to 90 and determines the largest value in each row. 
  //Rows largest element values arrange in ascending order, using the "Bubble" sort algorithm. N and M input by the user.</p>
  
  <pre><code>int i,j,rows, columns, temp, swapped;
  cout&lt;&lt;"How many rows? ";
  cin&gt;&gt; rows;
  cout&lt;&lt; "how many columns? ";
  cin&gt;&gt;columns;
  
  int array[rows][columns];
  
  for(i = 0; i&lt;rows; i++){
      for(j=0; j&lt;columns; j++){
          array[i][j] = rand()%90+10;
      }cout&lt;&lt;endl;
  }
  
  for(i = 0; i&lt;rows; i++){
      for(j=0; j&lt;columns; j++){
          cout&lt;&lt;array[i][j]&lt;&lt;" ";
      }
      cout&lt;&lt;endl;
  }
  for(i=0;i&lt;rows;i++){
  
  int max=array[i][0];
  
      for(j=0;j&lt;columns;j++){
  
          if(max  &lt;  array[i][j]){
  
          max = array[i][j];
      }
  
      }
          cout&lt;&lt;"Largest element in row" &lt;&lt; i &lt;&lt; "is: "&lt;&lt; max &lt;&lt; endl;
  }
  
  
  
      for(i=0; i&lt;rows;rows++){
  
  for(j=0; j&lt;columns; j++){
      if(max &gt; max+[1]){
          temp = max;
          max = max+[1];
          max+[1] = temp;
  
      }
  }
      }
  
  
  
      for(i=0; i&lt;rows;rows++){
  for(j=0; j&lt;columns; j++){
      cout&lt;&lt; max &lt;&lt; endl; 
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>return 0 ;
  </code></pre>
  
  <p>}</p>