保存游戏中的数据时游戏中常用的功能,Cocos2DX为我们提供CCUserDefault类。该类使用xml文件存储数据,并提供几个基本类型的存储接口。 //根据key获取指定的值,重载版本在没有读取到值返回的默认值 bool getBoolForKey(const char* pKey); bool...
分类:
其他好文 时间:
2014-07-12 12:55:01
阅读次数:
196
#include #include #include #include #include #include using namespace std;const int maxn = 3010;const int INF = 1 G[maxn];int dis;int n, m;bool vis[ma...
分类:
其他好文 时间:
2014-07-11 20:24:32
阅读次数:
256
BOOL savebitmap(const BITMAPINFOHEADER* pHeader, const char* data, int nImgW, int nImgH, const char* filename){ BITMAPINFOHEADER bmiHdr; //定义信息头 ...
分类:
编程语言 时间:
2014-07-11 19:11:19
阅读次数:
190
Problem Description推断两序列是否为同一二叉搜索树序列Input開始一个数n,(1#include #include using std::string;using std::cin;const int SIZE = (1>root; for (int i = 0; i >chi....
分类:
其他好文 时间:
2014-07-11 18:44:26
阅读次数:
205
用邻接矩阵写的。自己慢慢理解吧#include #include using namespace std;#define CC(c) memset(c, 0, sizeof(c))const int maxn=5000;int iscut[maxn], g[maxn][maxn], low[maxn...
分类:
其他好文 时间:
2014-07-11 08:45:04
阅读次数:
206
#include
using std::cout;
using std::endl;
//定义结构
struct Box{
double length;
double width;
double height;
};
double volume(const Box& aBox);
int main(){
Box box={70.0,60.0,40.0};
d...
分类:
编程语言 时间:
2014-07-11 08:37:11
阅读次数:
189
经验:避免返回handles(包括 references、指针、迭代器)指向对象内部。遵守这个条款可增加封装性,
帮助 const 成员函数的行为像个 const,并将发生“虚吊号码牌”(dangling handles)的可能性降至最低。
示例:
class Point{
public:
Point(int x, int y);
//...
void setX(int newVal);
void setY(int newVal);
//...
};
struct RectData{
Point...
分类:
编程语言 时间:
2014-07-10 22:56:05
阅读次数:
230
★相同点:
●都是地址的概念;
指针指向一块内存,它的内容是所指内存的地址;而引用则是某块内存的别名。
★不同点:
●指针是一个实体,而引用仅是个别名;
●引用只能在定义时被初始化一次,之后不可变;指针可变;引用“从一而终”,指针可以“见异思迁”;
●引用没有const,指针有const,const的指针不可变;
●引用不能为空,指针可以为空;
●“...
分类:
编程语言 时间:
2014-07-09 11:50:03
阅读次数:
209
题目大意:Codeforces 444C DZY Loves Colors
题目大意:两种操作,1是修改区间上l到r上面德值为x,2是询问l到r区间总的修改值。
解题思路:线段树模板题。
#include
#include
#include
#include
using namespace std;
const int maxn = 5*1e5;
typedef long ...
分类:
其他好文 时间:
2014-07-09 10:28:24
阅读次数:
153
LCA tarjan 的离线算法
#include
#include
#include
using namespace std;
const int maxn = 40010;
int first[maxn], head[maxn], cnt, sum;
struct edge
{
int u, v, w, next;
}e[maxn*2], qe[maxn], Q[maxn];
int...
分类:
其他好文 时间:
2014-07-09 10:23:35
阅读次数:
256