09 2011 档案
摘要:#pragma once#include "m_ball.h"#include <list>using namespace std;class CBallMgr{public:CBallMgr(void);~CBallMgr(void);m_ball *Create(hgeVector,double,bool, int,int);void Updata();private:list <m_ball*> m_ballList;};extern CBallMgr gBllMrg;#include "StdAfx.h"#include
阅读全文
摘要:一. vector1.声明: 一个vector类似于一个动态的一维数组。 vector<int> a; //声明一个元素为int类型的vector a vectot<MyType> a; //声明一个元素为MyType类型的vector a 这里的声明的a包含0个元素,既a.size()的值为0,但它是动态的,其大小会随着数据的插入 和删除改变而改变。 vector<int> a(100, 0); //这里声明的是一已经个存放了100个0的整数vector2.向量操作常用函数: size_t size(); // 返回vector的大小,即包含的...
阅读全文
摘要:set set是集合,set中不会包含重复的元素,这是和vector的区别。 定义: 定义一个元素为整数的集合a,可以用 set a; 基本操作: 对集合a中元素的有 插入元素:a.insert(1); 删除元素(如果存在):a.erase(1); 判断元素是...
阅读全文
摘要:dynamic_cast < type-id > ( expression ) 该运算符把expression转换成type-id类型的对象。Type-id必须是类的指针、类的引用或者void *; 如果type-id是类指针类型,那么expression也必须是一个指针,如果type-id是一个引用,那么expression也必须是一个引用。 dynamic_cast主要用于类层次间的上行转换和下行转换,还可以用于类之间的交叉转换。 在类层次间进行上行转换时,dynamic_cast和static_cast的效果是一样的; 在进行下行转换时,dynamic_cast具有类型检查的
阅读全文
摘要:string Int2Str(int val) { char buf[64] = ""; _snprintf(buf, sizeof(buf)-1, "%d", val ); return buf; } int str2int( const ...
阅读全文
摘要:以前一直用atl +F8来对齐代码,最近突然用不了,一按就给我弹出宏管理器,忍无可忍之下,看了一下选项,最后发现解决方法:工具->选项->环境->键盘->应用vs 6.0映射方案就ok了……
阅读全文
摘要:定义一个类一般都是在头文件中进行类声明,在cpp文件中实现,但使用模板时应注意目前的C++编译器还无法分离编译,最好将实现代码和声明代码均放在头文件中。如:test.htemplate <class T>class CTest{ public: T& GetValue(); void SetValue(const T& _Value);protected: T m_Value;};test.cpptemplate <class T>T& CTest<T>::GetValue(){ return m_Value; }template&l
阅读全文
摘要:#include <string.h>#include <iostream>using namespace std;int main(){char d[256]="hello";//char *s=" word";char s[256]=" word";strcat(d,s);cout<<d;getchar();return 0;}
阅读全文
摘要:#include <iostream>#include <vector>using namespace std;struct NODE{int m_nRoleID;int m_nScore;string m_strROleName;NODE() :m_nRoleID(1), m_nScore(0),m_strROleName("byfei"){}NODE(const int nRoleID, const int nScore,const string strRoleName) :m_nRoleID(nRoleID), m_nScore(nScore)
阅读全文
摘要:1.声明: 一个vector类似于一个动态的一维数组。 vector a; //声明一个元素为int类型的vector a vectot a; //声明一个元素为MyType类型的vector a 这里的声明的a包含0个元素,既a.size()的值为0...
阅读全文
摘要:virtualbox 4.08安装虚机Ubuntu11.04增强功能失败解决方法 引用 fuliang@fuliang-VirtualBox:~$ sudo /etc/init.d/vboxadd setup Removing existing Virtual...
阅读全文
摘要:引用fuliang@fuliang-VirtualBox:~$ sudo /etc/init.d/vboxadd setup Removing existing VirtualBox DKMS kernel modules ...done. Removing existing VirtualBox non-DKMS kernel modules ...done. Building the VirtualBox Guest Additions kernel modules The headers for the current running kernel were not found. If
阅读全文