每天学一点c++:#

#是预处理宏#define使用的,#使#后的第一个参数返回一个带双引号的字符串

示例:

#include <iostream>
using namespace std;

#define toString(s) # s
int main()
{
cout << toString(Hello World!) <<endl;
return 0;
}

cout << toString(Hello World!) <<endl;可以看做是cout << "Hello World!" <<endl;

输出Hello World!

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

导航