#include <iostream> #include <assert.h> // #define _NDEBUG #ifndef _NDEBUG #define _DEBUG #endif // _DEBUG using namespace std; bool TestValue(int a) { if ( a > 100 ) return false; else return true; } int main() { int x = 10; #ifdef _DEBUG assert( TestValue(x) ); #endif cout << "Hello world!" << endl; x = 20; assert( TestValue(x) ); cout << "New Hello World!" << endl; x = 120; #ifdef _DEBUG assert( TestValue(x) ); #endif cout << "The last line output!!!" << endl; return 0; } #include <iostream>#include <assert.h>// #define _NDEBUG#ifndef _NDEBUG #define _DEBUG#endif // _DEBUGusing namespace std;bool TestValue(int a){ if ( a > 100 ) return false; else return true;}int main(){ int x = 10; #ifdef _DEBUG assert( TestValue(x) ); #endif cout << "Hello world!" << endl; x = 20; assert( TestValue(x) ); cout << "New Hello World!" << endl; x = 120; #ifdef _DEBUG assert( TestValue(x) ); #endif cout << "The last line output!!!" << endl; return 0;}
// The whole process is very simple, and the idea is clear. You don't need to make comments. You can understand everything after you copy it and run it again.