title: Display their names in ascending order with respect to their ages?
body: <p>The stated problem is "Write a program that takes names and ages of 10 employees as input in a 2D <code>char</code> array and display their names in ascending order with respect to their ages".</p>
  
  <p>I've pasted below what I have so far, but I don't know how to display the names in ascending order with respect to age. What am I missing?</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;string.h&gt;
  void sort(int[],int);
  void main(void)
  {
      char a[10][5],x;
      int b[5],i,j;
      for(j=0;j&lt;=5;j++)
      {
          cout&lt;&lt;"Enter name of Employee:";        
          for(i=0;i&lt;10;i++)
          {
  
              cin&gt;&gt;x;
              x=a[j][i];
          }
          cout&lt;&lt;"Enter Employee's age:";
          cin&gt;&gt;b[j];
          cout&lt;&lt;endl;
      }
      sort(b,j);
      cout&lt;&lt;"Name of Employee \t\t Age \n";
      for(j=0;j&lt;5;j++)
      {
          for(i=0;i&lt;10;i++)
          {
              x=a[j][i];
              cout&lt;&lt;"\t"&lt;&lt;x;
          }   
          cout&lt;&lt;"\t\t"&lt;&lt;b[j]&lt;&lt;"\n";
      }
  }
  void sort(int x[],int size)
  {
      int temp,i,j;
      for(j=0;j&lt;size;j++)
      {
          for(i=0;i&lt;size;i++)
          {
              if(x[i]&gt;x[i+1])
              {
                  temp=x[i+1];
                  x[i+1]=x[i];
                  x[i]=temp;
              }
          }
      }
  }
  </code></pre>