不会是用选择排序法吧,先找个最大的,然后次之......

解决方案 »

  1.   

    如果你用的stl,就可以使用
    sort
    template<class RanIt>
        void sort(RanIt first, RanIt last);
    template<class RanIt, class Pred>
        void sort(RanIt first, RanIt last, Pred pr);
    The first template function reorders the sequence designated by iterators in the range [first, last) to form a sequence ordered by operator<. Thus, the elements are sorted in ascending order.The function evaluates the ordering predicate X < Y at most ceil((last - first) * log(last - first)) times.The second template function behaves the same, except that it replaces operator<(X, Y) with pr(X, Y).
      

  2.   

    比如我有一个容器vecPop,我用以下的语句但是达不到我想要的效果...,sort(m_vecPop.begin(), m_vecPop.end());这个语句能对m_vecPop作排序吗?