title: Bubble sort 2d array in alphabetical order only using iostream?
body: <p>I'm trying to figure out how I can sort a list of words in alphabetical order. The code I have now will sort them correctly, only if each word is only 1 letter. Once I move to more letters, it fails. Can you help me fix this. Thanks</p>
  
  <p>My input file is:</p>
  
  <pre><code>Emma
  Liam
  Dill
  Bill
  Kimm
  Jacks
  John
  Hats
  Julia
  Jill
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  void sort(char input[10][25], int size);
  
  int main(){
      char input[10][25] = {"Emma", "Liam", "Dill", "Bill", "Kimm", "Jacks", "John", "Hats", "Julia", "Jill"};
  
      sort(input,10);
  
      cout &lt;&lt; "Sorted:\n";
      for(int i = 0; i &lt; 10; i++){
          cout &lt;&lt; input[i];
      }
  
      return 0;
  }
  
  
  void sort(char input[10][25],int size){
  
      char temp;
      for(int k = 0;k &lt; 10;k++){
          for(int i = 0; i &lt; 9; i++){
              for(int j = 0; j &lt; 24; j++){
                  if(input[i][j] &gt; input[i+1][j]){
                      temp = input[i][j];
                      input[i][j] = input[i+1][j];
                      input[i+1][j] = temp;
                  }
              }
          }
      }
  
  }
  </code></pre>