#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto VariableX = uc.DefineVariable("x = 0"); auto Total = uc.DefineVariable("Total"); string Expression = "x++; Total = Total + x^2 + 5"; auto ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x++) { // Execute() runs the parsed expression without the overhead of returning a value. // This provides near-native performance for loops across C#, VB, and C++. ParsedExpr.Execute(); // Evaluate string interpolation to output the final calculated total cout << uc.EvalStr("$'{x} Sub total = {Total}'") << endl; } cout << uc.EvalStr("$'Total = {Total}'") << endl; ParsedExpr.Release(); VariableX.Release(); }