上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: srand函数是随机数发生器的初始化函数。原型:void srand(unsigned seed);用法:它需要提供一个种子,这个种子会对应一个随机数,如果使用相同的种子后面的rand()函数会出现一样的随机数。如: srand(1); 直接使用1来初始化种子。不过为... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(294) 评论(0) 推荐(0)
摘要: /* 快速排序的实现 coder:QPZ time:2014-12-04*/#include #include #include using namespace std;#define N 10void Swap(int &a,int &b){ int t; t... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(121) 评论(0) 推荐(0)
摘要: /* 例如,对于数列{pi}={5,3, 8, 2, 9},Huffman树的构造过程如下: 1. 找到{5, 3, 8, 2, 9}中最小的两个数,分别是2和3,从{pi}中删除它们并将和5加入,得到{5, 8, 9, 5},费用为5。 2. 找到... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(95) 评论(0) 推荐(0)
摘要: /* 归并排序实现 coder:QPZ time:2014-12-03*/#include #include #include using namespace std;class Mergesort{ private: ... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(98) 评论(0) 推荐(0)
摘要: /* N*N矩阵的旋转 不开辟新空间 programmer:qpz time:2014-11-09*/#include using namespace std;//#define MAX 3const int MAX=3;class cou{ priva... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(189) 评论(0) 推荐(0)
摘要: #include #include using namespace std; int main( void ) { const double value = 12.3456789; cout << value << endl; // 默认以6精度,... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(349) 评论(0) 推荐(0)
摘要: /* 探索内存对齐 coder:瞿鹏志 */ #include #include using namespace std; #pragma pack (8)typedef struct node2{ int a;//4 char b;//4 }node_... 阅读全文
posted @ 2014-12-15 20:56 机智的程序员小熊 阅读(98) 评论(0) 推荐(0)
摘要: /* 最大公约数,最小公倍数 programmer:qpz time:2014-11-03*/#include #include #include #define MAX 10void delay(int a,int b){ int j,k; ... 阅读全文
posted @ 2014-12-15 20:56 机智的程序员小熊 阅读(172) 评论(0) 推荐(0)
摘要: /* Sort programmer:qpz time:2014-11-02*/#include #define MAX 10//冒泡排序法 void BubbleSort(int *data,int n);//直接插入排序法void StraightInsert... 阅读全文
posted @ 2014-12-15 20:56 机智的程序员小熊 阅读(158) 评论(0) 推荐(0)
摘要: /* vector function template programmer:qpz*/#include #include #define MAX 10using namespace std;class Myclass{private: vector vel;... 阅读全文
posted @ 2014-12-15 20:56 机智的程序员小熊 阅读(89) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 下一页