|
You can find it just by looking for it, there will definitely be in the book of data structure.
It is not difficult to write one yourself.
#include <iostream>
using namespace std;
#define SUM 10
template <class T>
void Sort(T a[], int N)
{
for(int i=0; i<N-1; i++){
for(int j=i+1; j<N; j++){
if(a[i]<a[j]) swap(a[i], a[j]);
}
}
}
int main()
{
int a[]={5,6,8,3,9,7,2,1,4,0};
Sort(a, SUM);
for(int i=0; i<10; i++)
cout << a[i] << "";
return 0;
} |
|