038 白给的list排序


#include 
#include 
#include 
#include 
using namespace std;
int main()
{
    double a[] = { 1.2,3.4,9.8,7.3,2.6 };
    list lst(a, a + 5);
    lst.sort(greater());  //倒序排序

    for (list::iterator i = lst.begin(); i != lst.end(); ++i)
        cout << *i << ",";
    return 0;
}