每天学一点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!
浙公网安备 33010602011771号