#define testNumber 3
/*
1: output the first image
2: test "int &ri,int& ri,int*&pri"
3: output the first image by using vector.
*/
#if testNumber == 1 /*1: output the first image*/
//完整的测试代码1
#elif testNumber == 2 /*2: test "int &ri,int& ri,int*&pri"*/
//完整的测试代码2
#elif testNumber == 3 /*3: output the first image by using vector.*/
//完整的测试代码3
#endif // testNumber
可以通过修改宏定义中testNumber的值来控制编译的代码块,也就是控制测试模块。
想测试哪一块,就将testNumber修改成对应的值即可;
想添加一个新的测试块,在添加一个“#elif testNumber == …”即可。