#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int a; //必须进行初始化,否则出现编译错误
printf(STR(abc)); //宏STR(s)将s转变为一个字符串即输出,即输出abc。
cout<<CONS(2,3)<<endl; //宏CONS(a,b)将两个宏参数粘合在一起,即2e3,所以输出2000.
return 0;
}
#include <iostream>
using namespace std;
#define STR(s) #s //#把宏参数变为一个字符串
#define CONS(a,b) (int)(a##e##b) //##将两个宏参数粘合在一起int _tmain(int argc, _TCHAR* argv[])
{
const int a; //必须进行初始化,否则出现编译错误
printf(STR(abc)); //宏STR(s)将s转变为一个字符串即输出,即输出abc。
cout<<CONS(2,3)<<endl; //宏CONS(a,b)将两个宏参数粘合在一起,即2e3,所以输出2000.
return 0;
}