#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Trigger an error and check the code uc.EvalStr("1+"); cout << "1. Error code after failure: " << (int)uc.Error().Code() << endl; // A successful evaluation should clear the error code uc.EvalStr("1+1"); cout << "2. Error code after success: " << (int)uc.Error().Code() << endl; // Trigger a different type of error uc.Error().TrapOnDivideByZero(true); uc.EvalStr("1/0"); cout << "3. Error code after new failure: " << (int)uc.Error().Code() << endl; // A successful definition should also clear the error code uc.DefineVariable("x=5"); cout << "4. Error code after successful definition: " << (int)uc.Error().Code() << endl; }