博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年9月18日

摘要: 将博客搬至CSDN 阅读全文

posted @ 2014-09-18 20:29 jxiaoyu 阅读(104) 评论(0) 推荐(0)

2013年4月19日

摘要: 1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 int main() 5 { 6 vector<double> a; 7 vector<double> c; 8 vector<double>::iterator ita; 9 vector<double>::iterator itc;10 int k, m;11 int i, j;12 double temp;13 14 cin>>k;15 for (i = 0; i < 阅读全文

posted @ 2013-04-19 23:06 jxiaoyu 阅读(134) 评论(0) 推荐(0)

2013年4月11日

摘要: sizeof是一个奇特的函数,告诉你你也许不相信——sizeof在编译的时候就已经确定sizeof的结果了,这有点类似于宏。char str[] = “Hello”; //sizeof (str ) = 6 编译器编译的时候根据上下文完全知道str是一个数组,sizeof(str)=6理所当然是在求数组所占字节数,这个字节数在编译期间就可以确定(数组的大小必须在编译前指定好,C语言规定)void *p = malloc(100); //sizeof (p) = 4 编译器看到p是个指针,可是谁能保证指针所指内存的大小呢?尽管你这里写着100,但是malloc可是动态分配,没人... 阅读全文

posted @ 2013-04-11 10:27 jxiaoyu 阅读(119) 评论(0) 推荐(0)

2013年3月25日

摘要: 1 /* 2 * language: C 3 */ 4 #include <stdio.h> 5 int bsearch(int *a, int i, int j, int x) 6 { 7 int mid; 8 if (i == j) { 9 if (x == a[i])10 return i+1;11 else return -1;12 }13 mid = (i + j)/2;14 if (x == a[mid])15 return mid+1;16 else if... 阅读全文

posted @ 2013-03-25 11:11 jxiaoyu 阅读(106) 评论(0) 推荐(0)

2013年3月21日

摘要: 1 /* 2 * language: C 3 */ 4 void qsort(int *s, int left, int right) 5 { 6 if (left >= right) return; 7 int i, j, pivot; 8 i = left; 9 j = right;10 pivot = s[i];11 12 while (i < j) {13 while (i < j && s[j] > pivot) j--;14 if (i < j) s[i++] = s[j];15 ... 阅读全文

posted @ 2013-03-21 20:41 jxiaoyu 阅读(102) 评论(0) 推荐(0)

2012年10月9日

摘要: 字符集和类通配符. 匹配除\n外的任何单字符字符类[] 匹配所包含的任意一个字符,如[a-zA-Z],匹配小写或大写字母; 匹配的字符不在某个集合中,如[^a-z],匹配的字符不能是小写字母重复* 匹配前面的子表达式零次或多次+ 匹配前面的子表达式一次或多次() 子表达式可控的重复{} 如{n,m},匹配前面的子表达式最少n次,最多m次^,& 匹配字符串的开始位置,结束位置 | 表示选择,如com|edu|net 阅读全文

posted @ 2012-10-09 09:56 jxiaoyu 阅读(143) 评论(0) 推荐(0)

2012年10月7日

摘要: >> 一般模式下,使某行向右移动一个shiftwidth 反之 <<=motion 用内置的格式程序缩进选中文本,如将光标放在{ 处,=% 将花括号内文本缩进[CTRL-I, ]CTRL-I Search for a word under the cursor in the current file andany brought in by #include directives.gd, gD Search for the definition of a variable.]CTRL-D, [CTRL-D Jump to a macro definition.]d... 阅读全文

posted @ 2012-10-07 23:56 jxiaoyu 阅读(159) 评论(0) 推荐(0)

摘要: 三种视图模式字符选择模式 v行选择模式 shift-v块选择模式 ctrl-v帮助 加前缀v_,如 :help v_d在其中一种模式下可以用直接用上面的命令切换到另一模式在视图模式下编辑d 删除选中的字符 D 删除选中字符的行y,c命令同理J 将选中行合成一行,行这间用空格分隔 gJ 连接选中行并无空格分隔> 将选中行缩进一个shiftwidth 反之 <在块选择模式下I 插入,并且在<ESC>后,其他选中行的相应位置也会插入相同内容c,A命令有相类似的作用r 将选中块中的字符全部替代为某个字符> 将块向右移动一个shiftwidth 反之 <,如果空格数不 阅读全文

posted @ 2012-10-07 20:45 jxiaoyu 阅读(3743) 评论(0) 推荐(0)

2012年9月21日

摘要: 记忆方法:yy,xp,...右手方向为正 阅读全文

posted @ 2012-09-21 19:51 jxiaoyu 阅读(193) 评论(0) 推荐(0)

2012年9月9日

摘要: 打开一个新窗口 :split 切换到另一个窗口 CTRL-ww orCTRL-W CTRL-W向上一个窗口CTRL-wk向下一个窗口CTRL-wj在新窗口中打开另一文件:split fileThe :split command can also execute an initial command using the +commandconvention.For example,:split +/printf three.c. It meansopen another window with three.c, in addition, search printf in the file... 阅读全文

posted @ 2012-09-09 20:47 jxiaoyu 阅读(251) 评论(0) 推荐(0)