#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uc.DefineOperator("{x} MyOp {y} = x + y", 0); // Infix operator with alphanumeric name uc.DefineOperator("@@ {number} = number * 2", 0); // Prefix operator with symbolic name uc.DefineOperator("{val} % = val / 100", 0); // Postfix operator with symbolic name uc.DefineOperator("{a} times {b} = a * b", uc.ItemOf("*").Precedence()); // Specifying precedence uc.DefineOperator("{TextA As String} concat {TextB As String} As String = TextA + TextB", 0); // Specifying types cout << uc.Eval("5 MyOp 4") << endl; cout << uc.Eval("@@5") << endl; cout << uc.Eval("5 %") << endl; cout << uc.Eval("3 times 5") << endl; cout << uc.EvalStr("'Hello' concat ' world!'") << endl; }