1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream> #define DEBUG 0 using namespace std; int main() { #if DEBUG cout<<"OK!"<<endl; #endif #if !DEBUG cout<<"nice!"<<endl; #endif return 0; }
|
当DEBUG为1时输出”OK!”,为0时输出”nice!”
即DEBUG为1时,6-8行参与编译,9-11行不参与,反之亦然。
近期评论