#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uc.Format("Result = 'Answer: ' + Result"); uc.Format("DataType: String, Def: val = '<<' + val + '>>' "); uc.Format("DataType: Bool, Def: val = '[[' + val + ']]'"); // Note the difference between where "Bool: " and "String: " are displayed in the result uc.Format("InsertAt: 0, DataType: Bool, Def: val = 'Bool: ' + val"); // Inserts at 0th position of Bool uc.Format("InsertAt: 1, DataType: String, Def: val = 'String: ' + val"); // Inserts at 1st position of String cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; cout << "---" << endl; // This fomratting will be the last one to take effect uc.Format("InsertAt: 0, Def: val = 'Outer: ' + val"); cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; cout << "---" << endl; // This formatting will be the first one to take effect uc.Format("val = 'Inner: ' + val"); // Optionally InsertAt: -1 could have been used cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; cout << "---" << endl; uc.FormatRemove(); cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; }