#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Enable only the division by zero error uc.Error().TrapOnDivideByZero(true); // This should now raise a uCalc error cout << "Test 1 (Div by Zero): " << uc.EvalStr("1/0") << endl; // This should still return 'inf' by default, as we didn't enable overflow errors cout << "Test 2 (Overflow): " << uc.EvalStr("1e308 * 2") << endl; // For comparison, enable overflow errors as well uc.Error().TrapOnOverflow(true); cout << "Test 3 (Overflow with error): " << uc.EvalStr("1e308 * 2") << endl; }