Sort based on multiple things in C++
<pre><code>struct Record
{
    char Surname[20];
    char Initial;
    unsigned short int Gender; //0 = male | 1 = female
    unsigned short int Age;
};
Record X[100];
</code></pre>

<p>How can I use Quicksort to sort the values into increasing age, with females before males and surnames in alphabetical order? I've got a:</p>

<pre><code>bool CompareData(const int&amp; A, const int&amp; B)
{
    return Records[A].Age &lt; Records[B].Age; //this sorts by age atm
}
</code></pre>
