title: Sorting two corresponding arrays
body: <p>I have this code here that has two arrays. It sorts <strong>arr[]</strong>, so that the highest value will be in index 0. Now the second array <strong>arr1[]</strong> contains strings, I'd like the code to apply whatever changes where made to <strong>arr[]</strong> to <strong>arr1[]</strong>. So that <strong>arr[0]</strong> would return 6, while <strong>arr1[0]</strong> would return  the string <strong>"d1"</strong>. Notice how <strong>"d1"</strong> was at the same index as <strong>6</strong>? After sorting I'd like the same values to still have their string counterparts.  </p>
  
  <p>How would I go about doing this? </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;algorithm&gt;
  #include &lt;functional&gt;
  using namespace std;
  
  int main() {
    int arr[ 5 ] = { 4, 1, 3, 6, 2 };  
    string arr1[ 5 ] = { "a1", "b1", "c1", "d1", "e1" };
  
    std::sort( arr, arr + 5, std::greater&lt; int &gt;() );
    cout &lt;&lt; arr[0] &lt;&lt; arr1[0] &lt;&lt; endl;
  
    system("pause");
  }
  </code></pre>