// 第二十五章补充内容 5 不能为0的变量 /*#define DEBUG #include <iostream> #include <string> using namespace std; #ifndef DEBUG #define ASSCET(x) #else #define ASSCET(x)\ if(!(x))\ {\ cout<<"错误!ASSERT("<<#x<<")宏函数执行失败"<<endl;\ cout<<"错误的代码出现在第"<<__LINE__<<endl;\ cout<<"出错的文件是"<<__FILE__<<endl;\ } #endif class Circle { public: double check()const { return radius; } void set(double x) { ASSCET(check()); radius = x; ASSCET(check()); } double Result() { return 3.14*radius*radius; } private: double radius; }; int main() { Circle one; one.set(14); cout<<"圆的面积为"<<one.Result()<<endl; one.set(0); cout<<"圆的面积为"<<one.Result()<<endl; return 0; }*/