摘要: 先看代码: 1 function permgen (a, n) 2 if 0 == n then 3 printResult(a) 4 else 5 for i=1,n do 6 a[n], a[i] = a[i], a[n] 7 permgen(a, n -1) 8 a[n], a[i] = a[i], a[n] 9 end10 end11 end12 13 function printResult (a)14 for i,v in ipairs(a) do15 ... 阅读全文
posted @ 2012-08-19 12:04 good90 阅读(6762) 评论(0) 推荐(1) 编辑
摘要: 首先配置环境,百度文库里这个讲的很详细http://wenku.baidu.com/view/7912da3667ec102de2bd8957.html环境配置好之后,我也写了个简单的调用main.cpp 1 #include <stdio.h> 2 3 extern "C"{ 4 #include "lua.h" 5 #include "lualib.h" 6 #include "lauxlib.h" 7 }; 8 9 10 lua_State *L;11 int luaAdd(int x, int 阅读全文
posted @ 2012-08-19 00:11 good90 阅读(22469) 评论(2) 推荐(0) 编辑
摘要: loadrunner linux安装自然不用多讲,网上很多。推荐两个写的比较全的:http://www.51testing.com/?uid-116228-action-viewspace-itemid-219400http://lanyan-lan.iteye.com/blog/504979记一下我安装时遇到的问题:安装rsh-server时候找不到依赖error:RPM install Error:Failed dependencies needed *.so于是找到这个方法,当然了,如果你将需要的库安装起来会更好。rpm -i --force --nodeps rsh-server-0. 阅读全文
posted @ 2012-08-09 22:16 good90 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 看下面一个简单例1 function fac(n)2 if n == 0 then3 return 14 else5 return fac(n-1)6 end7 end像这种在函数的末尾返回一个函数就是尾调用,这个尾调用并不像C++函数调用一样需要额外的堆栈空间,而是相对于g... 阅读全文
posted @ 2012-08-09 22:09 good90 阅读(2498) 评论(5) 推荐(0) 编辑
摘要: 1、 C++扩充很简单2、 Vs 的release版本不对内存做任何操作--à对数组做初始化。3、 new调用构造函数,delete调用析构函数。new分配的空间是连续的。4、 cin.get()、cin.getline()获取一行、cin.put()5、 输出:dec、setw() .etc。6、 This指针指向类的非static成员7、 Static 成员不是类对象的组成部分,其独立于任何对象存在。8、 浅拷贝、深拷贝。9、 EA工具。UML建模。10、 多用组合has-a,少用继承is-a。11、 基类的虚构函数一定要是虚函数,否则在用基类指针指向派生类对象只执行基类的析构函 阅读全文
posted @ 2012-07-17 19:16 good90 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 在写 Linux 程序时,经常会遇到“段错误”(segmentation fault) 这样的问题。如果程序比较大,那么如果用 gdb 调试可能显得比较吃力。这时可以用 core dump 文件来进行分析。先看自己系统中是否打开了core dump生成core文件的开关ulimt -c如果输出为0则不会生成core文件,可以这样设置ulimit -c size //size为你要设置的core文件的最大大小若不想设置core文件大小,可这样设置ulimit -c unlimited/proc/sys/kernel/core_uses_pid中的数值说明生成的core文件是否添加pid作为扩.. 阅读全文
posted @ 2012-05-07 13:52 good90 阅读(919) 评论(0) 推荐(0) 编辑
摘要: 由于itoa()函数不是标准c语言函数,在linux下不能使用,但我们可以用sprintf()代替。char *itoa(int value, char *string,int radix); value为要转换的数值,radix说明value为几进制数(如二进制,十进制),string为转换成字符串后保存位置;int sprintf( char *buffer, const char *format, [ argument] … ) ; buffer相当于上面的string,format相当于radix,指定格式,后面的不定参数写上要转换的数值,相当于value;一个简单的例... 阅读全文
posted @ 2012-04-25 14:23 good90 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 在终端里运行sudo modprobe psmouse 启动触控板sudo modprobe -r psmouse 关闭触控板 good90参考:http://zhidao.baidu.com/question/332519741.html 阅读全文
posted @ 2012-04-04 14:44 good90 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 说起const、static、以及#define大家都知道,我一直以为我也是知道的,昨天一同学说他面试时被问到#define定义一个常量和const定义一个常量有什么不同,我整理了下思路,发现当想向他说清楚这个问题时,我发现自己对const和#define中有些问题还是很模糊,我想这可能就是某位高手说的:“当你可以向别人清楚的解释某个问题时,你才算真正懂了这个问题”。于是乎,赶紧学习了下,理理思路,记下。1、c语言中:1 const int i=10;2 int array[i] ; 这个i不能说是常量而是一个不可改变的变量,它的不可改变是由编译器确定的,因此将 i 作为数组的长度;会出错,. 阅读全文
posted @ 2012-03-19 17:05 good90 阅读(3148) 评论(1) 推荐(2) 编辑
摘要: 1、1 CString m_time;2 CTime theCurrentTime = CTime::GetCurrentTime();3 m_time = theCurrentTime.Format("%Y-%m-%d");2、1 struct tm *t;2 time_t tt;3 time(&tt);4 t=localtime(&tt);5 printf("%d-%d-%d\n",t->tm_year+1900,t->tm_mon+1,t->tm_mday);author:good90参考:http://blog. 阅读全文
posted @ 2012-03-06 10:23 good90 阅读(347) 评论(0) 推荐(0) 编辑