#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Define the variables that the operator's expression will use. uc.DefineVariable("i"); uc.DefineVariable("total"); // Define a new 'sum_to' operator at runtime. // It uses the built-in ForLoop function to sum numbers into the 'total' variable. uc.DefineOperator("{start} sum_to {end} = total = 0; ForLoop(i, start, end, 1, total = total + i)", 50); // Use the new operator. The result is stored in the 'total' variable. uc.Eval("1 sum_to 5"); cout << "The sum from 1 to 5 is: " << uc.Eval("total") << endl; }