NO8——排序

 1 //sort
 2 #include<algorithm>
 3 bool cmp(const int a,const int b)
 4 {
 5     return a>b;//降序排列
 6 }
 7 
 8 //qsort
 9 #include <stdlib>
10 int cmp(const void *x,const void *y)
11 {
12     return (*(int*)x-*(int*)y);//升序
13 }
14 qsort(s,n,sizeof(s[0]),cmp);//调用
原文地址:https://www.cnblogs.com/xzxl/p/7305668.html