摘要: 顺序存放的一组整数,查找某个数的下标int BSearch(int a[],int low, int height,int x){ if (low > height) { return 0; } static int L = low,H = height; int tmp = (L + H -1)/2; if(a[tmp] == x) return tmp; if (x>a[tmp]) { L = a[tmp]; BSearch(a,L,H,x); } else { ... 阅读全文
posted @ 2013-10-22 17:07 CPYER 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 1. new int[] 是创建一个int型数组,数组大小是在[]中指定,例如: int * p = new int[10]; //p执行一个长度为10的int数组。2. new int()是创建一个int型数,并且用()括号中的数据进行初始化,例如: int *p = new int(10); // p指向一个值为10的int数。int a = 10,也叫静态创建,申明的变量的内存在栈里面;int *p=new int(10)是在“堆”上指定了一个int变量,并把该变量的地址赋给了int *型指针p;该变量没有名称,只能通过*p访问;当程序退出定义该变量的板块后,该变量仍然存... 阅读全文
posted @ 2013-10-22 10:48 CPYER 阅读(984) 评论(0) 推荐(0) 编辑
摘要: 1>tmp.cpp(24): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.在编程过程中难免会用到一些过时,或者曾经不安全的函数,如上,这是编译器会出现warning提示用某某新函数,如果不想使用新的函数可以使用一下方法:1. 使用VS提供的 编译器选择性提供wa 阅读全文
posted @ 2013-10-22 09:31 CPYER 阅读(606) 评论(0) 推荐(0) 编辑