#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Use the ExpressionTransformer for multi-word syntax.
   auto t = uc.ExpressionTransformer();

   // Note: Captured variables are passed to @Eval as text
   // Double() converts the text to Double a precision value
   uc.Format("Result = Format('{:.2f}', Double(Result))", uc.DataTypeOf("Double"));
   t.FromTo("{@Number:amount} USD to EUR", "({@Eval: Double(amount) * 0.92})");
   t.FromTo("{@Number:amount} EUR to USD", "({@Eval: Double(amount) / 0.92})");

   cout << "100 USD is approx. " << uc.EvalStr("100 USD to EUR") << " EUR" << endl;
   cout << "120 EUR is approx. " << uc.EvalStr("120 EUR to USD") << " USD" << endl;
}