title: How to sort the letters in a string into alphabetical order in c / c++?
body: <p>hi all
  in this code when i write AaBc it writes ' ABab' .
  what should i change in this code ,if i want it writes like ' AaBb '???</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include&lt;iostream.h&gt;
  #include&lt;string.h&gt;
  int main (void)
  {
      char string[128], temp;
      int n, i, j;
  
      printf("\nEnter string: ");
      gets(string);
  
      n = strlen(string);
  
      for (i=0; i&lt;n-1; i++)
      {
          for (j=i+1; j&lt;n; j++)
          {
              if (string[i] &gt; string[j])
              {
                  temp = string[i];
                  string[i] = string[j];
                  string[j] = temp;
              }
          }
      }
      printf("\n%s", string);
      printf("\n");
      return 0;
  }
  </code></pre>