Hi, I've been working on this program and I don't get the right results for some odd reason. I want "all" of the following numbers to be in descending order.
12180
13240
19800
22458
17000
18125
15623
3200
6500
11970
8900
10000
6200
Here's the code, I do get the first three values in the list but none of the other numbers display. I want all the number to display in descending order. Where am I going wrong? Thank you for the help.
Code:
void Print_descending(const int list[], int length)
{
int index;
int max;
cout << "The numbers in descending order: ";
max = list[0];
for (index = 0; index < length; index++)
{
while (list[index] > max)
max = list[index];
}
cout << max << endl;
}