• 2023-06-18C++ STL(algorithm)
    1字符和整数排序#include<iostream>#include<algorithm>usingnamespacestd;voidstl1(){inta[]={-1,9,-34,100,45,2,98,32};intlen=sizeof(a)/sizeof(int);sort(a,a+len);//由小到大排列sort(a,a+len,greater<int>());//由大到小排列}vo
  • 2023-06-18C++ STL(algorithm)
    1字符和整数排序#include<iostream>#include<algorithm>usingnamespacestd;voidstl1(){inta[]={-1,9,-34,100,45,2,98,32};intlen=sizeof(a)/sizeof(int);sort(a,a+len);//由小到大排列sort(a,a+len,greater<int>());//由大到小排列}vo
  • 2023-06-02remove_if的使用
    remove_if(iterator1,iterator2,func());用于对容器内的元素进行操作,源码如下:template<classForwardIterator,classUnaryPredicate>ForwardIteratorremove_if(ForwardIteratorfirst,ForwardIteratorlast,UnaryPredicatepred){Fo