Ok, So I got this assignment from my professor, and I know the first sections of code are correct, he pretty much gave them to us in class. But in the last section, section 5, I need to sory by decreasing order. He gave us a "hint" and said to sort by the number of astisks that are outputted, he also said to use the two sorting methos in the book selectionSort or Bubble sort. I think selection sort will work, but have no clue how to get it to work.

Please help!Code:#include<iostream> #include<iomanip> using namespace std; const int size = 11; int arx[size]; // if you want void printHist(); // Print histogram function (Sec. 2, 4, 6) // void sortHist(); // Sort histogram function (Sec. 5) void main() // section 1-3 { int i, j, temp; srand(9876); for (i=0; i<size; i++) arx[i]=0; for (i=0; i<2000; i++) arx[rand()%11]++; for (i=0; i<size; i++) { cout << arx[i] << ":" ; for (j=0; j<arx[i]; j+=10) cout<< "*" ; cout << endl; } // Section 4 cout<<endl<<endl; for (i=0; i<size; i++) arx[i]=0; for (i=0; i<2000; i++) { temp=((rand()%11) + (rand()%11))/2; arx[temp]++; } for (i=0; i<size; i++) { cout << arx[i] << ":" ; for (j=0; j<arx[i]; j+=10) cout<< "*" ; cout << endl; } //Section 5 Sort from greatest to least number of **** cout<<endl<<endl; for (i=0; i<size; i++) arx[i]=0; for (i=0; i<2000; i++) { temp=((rand()%11) + (rand()%11))/2; arx[temp]++; } for (i=0; i<size; i++) { cout << arx[i] << ":" ; for (j=0; j<arx[i]; j+=10) cout<< "*" ; cout << endl; } } // main

Thanks in advance!

Jessica