随笔分类 -  经典代码

摘要:七种qsort排序方法 <本文中排序都是采用的从小到大排序> 一、对int类型数组排序 1 int num[100]; 2 3 //Sample: 4 5 int cmp ( const void *a , const void *b ) 6 { 7 return *(int *)a - *(int *)b; 8 } 9 10 qsort(num,100,sizeof(num[0]),cmp); 二、对char类型数组排序(同int类型) 1 char word[100]; 2 3 //Sample: 4 5 int cmp( const void *a , const void 阅读全文
posted @ 2013-02-09 11:17 上白泽慧音 阅读(819) 评论(0) 推荐(0)
摘要:来自刘汝佳的书/****************************************************/#include #include #include #include #include #include #include #include #include #define EPS 1E-8using namespace std;typedef long long LL;/****************************************************/ const int maxn = 200; struct bign{ int len, s. 阅读全文
posted @ 2013-01-28 23:03 上白泽慧音 阅读(407) 评论(0) 推荐(0)