sort函数默认的排序方式是升序排序,即从小到大。 对简单的数组排序 简单来说就是sort(begin,end,cmp); sort函数中参数有三个(第三个可以省略) 其中begin是排序数组的起始地址 end是排序数组的结束地址(最后一位要排序元素的地址)这两个参数都是地址。 #include <iostream> #include<algorithm> using namespace std; int main() { int a[6]={6,2,3,1,5,10}; sort(a,a+6); for(int i=0;i<6...