编程语言(C)
文章平均质量分 67
无边际的梦想无止境的追求
有一种力量,无人能抵挡,它永不言败,生来倔强;有一种理想,照亮了迷茫,在这写满荣耀的地方
展开
-
无序n个元素中,寻找第K大的元素 O(n)
#include void swap(int *a,int *b){ int tmp; tmp = *a; *a = *b; *b = tmp; } int partition(int arr[],int left,int right,int pivotIndex){ int storeIndex = left; int pi原创 2016-04-04 01:27:13 · 502 阅读 · 0 评论 -
读写二进制file
C语言中声明 const int i = 2; 在另一个模块中使用此变量 extern const int i; C++中另一个模块中使用此变量 extern const int i = 2; 如果C++使用C中的extern变量,则extern "C" const int i = 2; //C和C++按照行存储数据,MATLAB按照列存储数据 //MATLAB中提供四个函数来读写二进制原创 2016-04-04 15:12:22 · 708 阅读 · 0 评论 -
库和框架
//fork()模拟多个客户端同时访问设定的URL,测试压力下网站工作的性能,最多可以模拟3万多个并发连接 #include #include #include #include #include #include #include #include #include #include #include #include int Socket(原创 2016-04-04 15:23:55 · 252 阅读 · 0 评论 -
存储、读取二进制的图像
#include #include #include #include "cv.h" #include "highgui.h" using namespace cv; using namespace std; void main(){ FILE *fpw = fopen("E:\\patch.bin","wb"); if(fpw == NULL){原创 2016-04-04 21:07:39 · 294 阅读 · 0 评论 -
获取文件路径
#include #include #define _MAX_PATH 260//max length of full pathname #define _MAX_DRIVE 3 //max length of drive component #define _MAX_DIR 256 //max length of path component #define _MAX_FNAME原创 2016-04-04 21:09:36 · 181 阅读 · 0 评论 -
直接插入排序
//直接插入排序 #include #include #define GETCOUNT(x) (sizeof(x) / sizeof((x)[0])) void insertSort(int *a,int n){ int tmp,j; for(int i=1;i tmp = a[i]; j = i; whil原创 2016-04-04 21:38:03 · 186 阅读 · 0 评论