Here is the osrt method I am using. I created an array of int's to try it out for now.
I am passing it month[] which is an array of int's(1-12) and the rainfall amounts the user has entered, plus the size of the arrays.
Code:
void dualSort(int month[], double precip[], int size) {
int start, maxIndex, tempMonth;
double maxAmount;
for (start = 0; start < (size - 1); start++) {
maxIndex = start;
maxAmount = precip[start];
tempMonth = month[start];
for (int index = start + 1; index < size; index++) {
if (precip[index] > maxAmount) {
maxAmount = precip[index];
tempMonth = month[index];
maxIndex = index;
}
}
precip[maxIndex] = precip[start];
month[maxIndex] = month[start];
precip[start] = maxAmount;
month[start] = tempMonth;
}
}