/*
* test_define.cpp
*
* Created on: Mar 30, 2018
* Author: zlf
*/
#include<iostream>
using namespace std;
#define New_Variable(name, i) int name##i
int main()
{
cout<<"hello main"<<endl;
New_Variable(Variable, 0) = 3;
New_Variable(Variable, 1) = 4;
int result = Variable0 + Variable1;
cout<<"Variable0: "<<Variable0<<endl;
cout<<"Variable1: "<<Variable1<<endl;
cout<<"result: "<<result<<endl;
cout<<"goodbye main"<<endl;
return 0;
}
运行结果:
hello main
Variable0: 3
Variable1: 4
result: 7
goodbye main