
C++
pymqq
北京邮电大学11级硕士,14年3月毕业,入职阿里巴巴商家业务事业部,研究方向深度学习、计算机视觉。
展开
-
In C++, which of the following syntax can be used for instantiating an object named arr of the vecto
A.vector arr; B.vector arr; C.vector(int) arr; D.vector arr(int); E.vector arr; 选A原创 2013-11-03 12:23:14 · 715 阅读 · 0 评论 -
In which of the following does a C++ developer use the placement new syntax to make new allocate an
A.new memaddr MyClass; B.new(memaddr) MyClass; C.new MyClass(memaddr); D.new MyClass memaddr; E.new (memaddr, MyClass); 选择B原创 2013-11-03 12:31:47 · 1152 阅读 · 0 评论 -
Which of the following statements describe the result when standard new CANNOT allocate the requeste
A.It throws an insufficient_memory exception. B.It returns null. C.It throws a bad_alloc exception. D.It returns silently with no effect on the expression. E.It logs an error message to the me原创 2013-11-03 13:09:19 · 962 阅读 · 0 评论 -
子序列、子串问题
#include#include using namespace std;//enum decreaseDire {kInit = 0,kLeft = 1,kUp = 2,kLeftUp = 4};enum decreaseDire {kInit = 0,kLeft = 1,kUp = 2,kLeftUp = 4};//打印任意一个公共子序列void LCS_Pri原创 2013-11-03 16:57:03 · 616 阅读 · 0 评论 -
轮盘赌算法
/** 按设定的概率,随机选中一个个体* P[i]表示第i个个体被选中的概率*/int RWS(){ m =0; r =Random(0,1); //r为0至1的随机数 for(i=1;i<=N; i++) { /* 产生的随机数在m~m+P[i]间则认为选中了i * 因此i被选中的概率是P[i] */ m = m + P[i];转载 2014-01-10 15:35:59 · 1461 阅读 · 2 评论 -
C和C++混合编程中使用bool
在原来bool类型的定义处替换成如下代码即可:#ifndef __cplusplus#define true 1 #define false 0 typedef unsigned char bool;#endif原创 2014-03-04 03:59:02 · 693 阅读 · 0 评论 -
MFC 清除重绘picture 控件
清除Pic中的图片 先置空 ,在刷新窗体m_nPic.SetBitmap(NULL);或者GetDlgItem(控件名字)->SetBitmap(NULL);刷新窗体 this->RedrawWindow();转自:http://liyangfd.blog.163.com/blog/static/36910383201032154432486转载 2014-03-04 10:40:26 · 6515 阅读 · 1 评论 -
十六进制转二进制输出
输出结果:000111010000000000000100001101000100110010011000原创 2014-06-17 17:54:34 · 850 阅读 · 0 评论 -
Which of the following expression(s) will NOT cause an error when used to replace the ***** in the C
#include class Outer { public: static int m_Out; class Inner { public: static int m_In; void Display(); }; }; int Outer::m_Out = 10; int Outer::Inner::m_In = 25原创 2013-11-03 12:20:03 · 994 阅读 · 0 评论 -
不同进程同时调用同一个DLL
不同进程之间共享DLL的只读数据段,可写的数据段每个进程有单独一份,不会相互冲突啊。原创 2013-10-25 11:22:44 · 3176 阅读 · 0 评论 -
.obj 与 .exe 的区别
obj里存的是编译后的代码跟数据,并且有名称,所以在连接时会出现未解决的外部符号一说。当连成exe后便不存在名称的概念了,只有地址。lib就是一堆obj的组合。 编译器会默认链接一些常用的库,其它的需要你自己指定。目标文件,一般是程序编译后的【二进制文件】,再通过链接器和资源文件链接就成可执行文件了。OBJ只给出了程序的【相对地址】,而可执行文件是【绝对地址】。原创 2013-10-25 10:34:07 · 5128 阅读 · 1 评论 -
未指定类型(void*)的两个数交换
#ifndef _SWAP_H#define _SWAP_Hvoid swap(void* x,void* y,int size){ void* temp=(void*)malloc(size); memcpy(temp,x,size); memcpy(x,y,size); memcpy(y,temp,size); free(temp);}#endif /* _SWAP_H原创 2012-05-29 20:18:21 · 627 阅读 · 0 评论 -
哈哈……
#include #include #include #include using namespace std;int main(){ int a[]={5,1,9,4,6,2,0,3,8,7}; make_heap(a,a+10,less()); cout<<"make_heap:"; copy(a,a+10,ostream_iterator(cout," ")); c原创 2012-06-08 11:40:04 · 346 阅读 · 0 评论 -
make_heap 和 push_heap
#include #include #include #include using namespace std;int main(){ int a[]={5,1,9,4,6,2,0,3,8,7}; make_heap(a,a+10,less()); cout<<"make_heap:"; copy(a,a+10,ostream_iterator(cout," ")); c原创 2012-06-08 11:28:18 · 734 阅读 · 0 评论 -
结构体在C与C++中的异同
定义一个结构体Point,如果在C语言里面定义结构体变量时必须添加struct关键字。比如:struct Point pos;如果不添加struct关键字,则报如下错误:error C2065: 'Point' : undeclared identifier。在C++中就不需要关键字struct。正确代码://比较strcut在C与C++中的异同,C语言struct Point {原创 2013-05-10 14:41:05 · 579 阅读 · 0 评论 -
MFC CString 转 char*
在VS2008中,按下图所示设置:CString cst;char *ptr = cst;原创 2013-05-13 17:57:22 · 753 阅读 · 0 评论 -
C/C++ 测耗时
LARGE_INTEGER frequency,start,stop; QueryPerformanceFrequency(&frequency); srand(time(NULL)); QueryPerformanceCounter(&start);QueryPerformanceCounter(&stop); double time; time = (stop.QuadPart-s原创 2013-08-01 16:14:51 · 763 阅读 · 0 评论 -
C++多重继承,虚函数表的次序
#include using namespace std;class Base;//typedef void(Base::*Fun)(void);class Base1 {public: virtual void f() { cout << "Base1::f" << endl; } virtual void g() { cout << "Base1::g" << en原创 2013-10-02 20:51:11 · 808 阅读 · 0 评论 -
C/C++获取当前函数名及所在行行数
关键字分别为:__FUNCDNAME__、__FUNCTION__、__FUNCSIG____FUNCSIG__表示可以获取函数名的详细信息,如下所示:printf("FUNCINFO:%s\n",__FUNCSIG__);输出:FUNCINFO:int __cdecl parse_AllCur_SeqImgInfo_BothMode(char *,struct ImageIn原创 2013-10-08 14:57:49 · 7685 阅读 · 1 评论 -
beyond compare 按行进行逐行比较
“会话”-“会话设置”-“对齐”-”替补方法“,完成!原创 2013-07-02 08:55:20 · 13477 阅读 · 1 评论