title: How to Sort String in array c++
body: <p>I am using this function to sort names in a string array alphabatically. But it is not working. If anyone has best solution for it, kindly Answer this question.</p>
  
  <pre><code>void List::sort_Name()
  {
      string temp;
      for (int i = 0; i &lt; cap; i++)
      {
          for (int j = 0; j &lt; cap; j++)
          {
              if (Prolist[i].getName() &lt; Prolist[i + 1].getName())
              {
  
                  temp = Prolist[i].getName();
                  Prolist[i].getName() = Prolist[i + 1].getName();
                  Prolist[i + 1].getName() = temp;
              }
          }
      }
  }
  </code></pre>