每天学一点c++:##

##连接前后的内容,使之成为一个整体

示例:

#include <iostream>
#include <string>
using namespace std;

#define concatenate(x) x ## y

int main()
{
string xy ="Hello,World!";
cout << concatenate(x,y) <<endl;
return 0;
}

cout << concatenate(x,y) <<endl;等同于cout << xy <<endl;

posted on 2014-03-31 16:49  敖天  阅读(177)  评论(0)    收藏  举报

导航