title: Sort names alphabetically
body: <p>I'm trying to sort names alphabetically
  e.g If user enters names and GPA:</p>
  
  <pre><code>Names          GPA
  Peter          2.8
  Robert         5.6
  David          7.8
  </code></pre>
  
  <p>The output should be : -</p>
  
  <pre><code>Names          GPA
  David          7.8
  Peter          2.8
  Robert         5.6
  </code></pre>
  
  <p>Here is my program so far (<strong>INCOMPLETE</strong>):-</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      char name [5][25];
      float gpa [5];
      int i;
  
      for (i=0 ; i&lt;5 ; i++)
      {
          cout &lt;&lt; "Enter name " &lt;&lt; i+1 &lt;&lt; "  :   ";
          cin &gt;&gt; name [i];
          cout &lt;&lt; "Enter GPA     :   ";
          cin &gt;&gt; gpa [i];
          cout &lt;&lt; endl;
      }
  
      cout &lt;&lt; "\n********** Your entered data **********\n\n";
  
      cout &lt;&lt; "\tName" &lt;&lt; "\t\t" &lt;&lt; "GPA\n\n";
  
      for (i=0 ; i&lt;5 ; i++)
      {
          cout &lt;&lt; "\t" &lt;&lt; name [i] &lt;&lt; "\t\t" &lt;&lt; gpa [i];
          cout &lt;&lt; endl;
      }
  
      for (i=0 ; i&lt;5 ; i++)
      {
          for (int j=0 ; j&lt;1 ; j++)
          {
              cout &lt;&lt; (int) name [i][j] &lt;&lt; endl;
  
  
  
          }
      }
  
      cout &lt;&lt; "\n\n******* Sorted data (w.r.t name) *******\n\n";
  
      cout &lt;&lt; "\tName" &lt;&lt; "\t\t" &lt;&lt; "GPA\n\n";
  
      for (i=0 ; i&lt;5 ; i++)
      {
          cout &lt;&lt; "\t" &lt;&lt; name [i] &lt;&lt; "\t\t" &lt;&lt; gpa [i];
          cout &lt;&lt; endl;
      }
  
      cout &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Remember, only name should be sorted alphabetically. I have taken the ASCII values of the first characters of entered names in the middle <code>for</code> loop but:-
  1-  ASCII code for 's' is not the same as 'S' (That's a problem for me)
  2-  I can't seem create a logic to compare the ASCII values of the first letters of names then sort them accordingly. Then afterwards linking the name with the sorted letter list and displaying the result. Also the GPA should be linked with the names.</p>
  
  <p>Any help would be appreciated.</p>