码迷,mamicode.com
首页 > 编程语言 > 详细

模板 排序

时间:2015-05-03 10:35:35      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:

【模板】排序

 

 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.h>
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);//调用

 

模板 排序

标签:

原文地址:http://www.cnblogs.com/jeff-wgc/p/4473374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!