#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Get the transformer that pre-processes expressions. auto t = uc.ExpressionTransformer(); // Define a rule to find "X in to cm" and replace it with the calculated value. // Note: 'val' is captured as text and must be converted to a number with Double(). t.FromTo("{@Number:val} in to cm", "({@Eval: Double(val) * 2.54})"); // Use the new syntax directly in an expression. cout << uc.EvalStr("10 in to cm") << endl; }