decending order

I was given the code at the bottom to which is in ascending and need to modify it to decending but cant figure out how?

#include <iostream>
using namespace std;
void rnd (float);
void sortArray(double[],int);
int main()
{
const int NUM_TEST = 100;
double score[NUM_TEST], average;
double total=0.0;
int test, nums[100];
for (test = 0; test < NUM_TEST; test ++)
{
cout<< "Test " << (test+1) << " score is ";
cin>> score[test];
if(score[test] == -1)
{
break;
}
total += score[test];
}
sortArray(score, 20);
average = total/test;
rnd (average);
cout << "Total is " << total <<endl;
system("pause");
return 0;
}

void rnd (float average)
{
if( (average + 0.5) >= (int(average) + 1) )
cout << "Average is " << int(average)+1<< endl;
else
cout << "Average is " << int(average)<< endl;
}

void sortArray(int score,int count) //store array addr & size
{
int hold, a, b, nums; // a and b are subscripts
for(a = 0; a < count-1; a++) //start first loop with 0
{
for(b = a+1; b < count; b++) //start second loop with 1
{
if(nums[a] > nums[b]) //compare nums[0] to nums[1]
{
hold = nums[a]; // if first is bigger
nums[a] = nums[b]; // swap the two
nums[b] = hold;
}
}
}
}



Do you understand how the sort function is currently working? That would go a long way to understanding how to modify it.
no i dont understand it at all
Topic archived. No new replies allowed.