title: sorting array and matching other array
body: <p>I'm trying to write a program where I write information of people like: name,minutes and seconds.I need to sort people by the time. I can't understand how to sort minutes and dont lose other array sequence order- name and second. they just stay standing where they stood. </p>
  
  <pre><code>#include &lt;iostream&gt;          
  #include &lt;algorithm&gt;
  #include &lt;string&gt;
  using namespace std;
  
  struct people{
  int min[6], sec[6];
  string name[6];
  };
  int main()
  {
   int temp;
   people z;
  for(int i=0; i&lt;6; i++)
      {
     cin&gt;&gt;z.name[i];
     cin&gt;&gt;z.min[i];
     cin&gt;&gt;z.sec[i];
   }
  sort(z.min,z.min+6);
  cout&lt;&lt;endl;
  
  for(int i=0; i&lt;6; i++)
      {
      cout&lt;&lt;z.name[i]&lt;&lt;" "&lt;&lt;z.min[i]&lt;&lt;" "&lt;&lt;z.sec[i]&lt;&lt;endl;
   }
      return 0;
  }
  /*Input for example is :
  
  John 6 15  
  Liza 9 59 
  Michael 19 45 
  Kira 2 37 
  Thomas 5 41 
  Justas 13 24 
  /*
  </code></pre>