#include typedef int (__stdcall* FUN)(int);//定义函数指针,参数为Int,返回为int,调用约定__stdcallint __stdcall fun1(int x){ std::cout << x << std::endl; return x;...
分类:
其他好文 时间:
2014-07-10 00:45:12
阅读次数:
203
c++中有非常多转义字符:\b表示的是回退,比方cout<<"hello world"<<'\b'<<endl;在屏幕上显示的仍然是hello world,由于在屏幕上已经输出了,\b并非退格键,它仅仅是相应移动光标往前一个,可是接下的输出就是从光标处開始,比方cout<<"hello w\borl...
分类:
编程语言 时间:
2014-07-07 17:14:11
阅读次数:
209
#include using namespace std;unsigned int i1=3;unsigned int i2=6;int i3=i1-i2;cout<<i3<<endl; //-3
分类:
其他好文 时间:
2014-07-03 06:52:51
阅读次数:
263
1、声明一个指针int *pcount; //一个指向int variable的指针,命名为pcountint count = 5;pcount = &count;//&是取地址符, *pcount=&count是错的cout << count; //5cout << pcount; //输出...
分类:
其他好文 时间:
2014-07-03 00:53:38
阅读次数:
317
#include#include#define min(a,b)!(b<a)?a:bint main(){ int a=1,b=2; std::cout<<(std::min)(a,b); return 0; }加入一个括号,std::min就不会被宏替代了。
分类:
其他好文 时间:
2014-07-02 21:20:14
阅读次数:
197
#includeusing namespace std;int main(){ int a,b,c; cin>>a>>b>>c; if(a==b) cout<<"C"<<endl; else if(b==c) cout<<"A"<<endl; else cout<<"B"<<endl; ret...
分类:
其他好文 时间:
2014-07-02 19:25:08
阅读次数:
200
例子
example 1
注:若一个基类同时派生出两个派生类,即两个派生类从同一个基类继承,那么系统将为每一个简历副本,每个派生类独立地使用自己的基类副本(比如基类中有属于自己类的静态变量等)。
#include
class Person
{
public:
person() {cout
~person() {cout
};
class Student:p...
分类:
编程语言 时间:
2014-07-02 07:50:53
阅读次数:
270
在cocos2dx 2.2.2版本中,cocos使用的是CLOG写入日期,其格式是C的Printf方式生成日志。现在也有很多C++流式日志,类似于cout这样的操作。我看了也有很多,log4cxx,等。但是个人移动有些大。我就在我原来的日志中增加了对流式的支持。并顺利移植到cocos2dx环境中使用。下载是在cocos2dx使用的例子。
cocos2dx的日志端类:
#ifndef _X_...
分类:
其他好文 时间:
2014-07-01 11:06:31
阅读次数:
253
外观模式(Facade),为子系统中的一组接口提供一个一致的界面,此模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。 外观模式结构图:代码模板://四个子系统的类class SubSystemOne{public: void MethodOne() { cout MethodOne();...
分类:
其他好文 时间:
2014-06-30 11:40:31
阅读次数:
201
#include
#include
#include
using namespace std;
int main()
{
vector password;
int len = 0;
cout << "Enter password: ";
while( true ){
char ch = getch();
if( ch == 1...
分类:
编程语言 时间:
2014-06-29 23:57:16
阅读次数:
406