Output formatting without using a callback
ID: 27
using uCalcSoftware;
var uc = new uCalc();
// The output is surrounded by < and >, and prepended with Answer:
uc.Format("Result = 'Answer: <' + Result + '>'");
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
uc.FormatRemove();
Answer: <30>
Answer: <Hello world>
Answer: <false> using uCalcSoftware; var uc = new uCalc(); // The output is surrounded by < and >, and prepended with Answer: uc.Format("Result = 'Answer: <' + Result + '>'"); Console.WriteLine(uc.EvalStr("10+20")); Console.WriteLine(uc.EvalStr("'Hello '+'world'")); Console.WriteLine(uc.EvalStr("5 > 10")); uc.FormatRemove();
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// The output is surrounded by < and >, and prepended with Answer:
uc.Format("Result = 'Answer: <' + Result + '>'");
cout << uc.EvalStr("10+20") << endl;
cout << uc.EvalStr("'Hello '+'world'") << endl;
cout << uc.EvalStr("5 > 10") << endl;
uc.FormatRemove();
}
Answer: <30>
Answer: <Hello world>
Answer: <false> #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // The output is surrounded by < and >, and prepended with Answer: uc.Format("Result = 'Answer: <' + Result + '>'"); cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; uc.FormatRemove(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// The output is surrounded by < and >, and prepended with Answer:
uc.Format("Result = 'Answer: <' + Result + '>'")
Console.WriteLine(uc.EvalStr("10+20"))
Console.WriteLine(uc.EvalStr("'Hello '+'world'"))
Console.WriteLine(uc.EvalStr("5 > 10"))
uc.FormatRemove()
End Sub
End Module
Answer: <30>
Answer: <Hello world>
Answer: <false> Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// The output is surrounded by < and >, and prepended with Answer: uc.Format("Result = 'Answer: <' + Result + '>'") Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) uc.FormatRemove() End Sub End Module