Different output formats for different data types
ID: 28
using uCalcSoftware;
var uc = new uCalc();
// String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]]
uc.Format("DataType: String, Def: val = '<<' + val + '>>' ");
uc.Format("Bool, val = '[[' + val + ']]'"); // Shortcut notation without "DataType" or "Def"
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
Console.WriteLine(uc.EvalStr("5 < 10"));
uc.FormatRemove();
Console.WriteLine("---");
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
Console.WriteLine(uc.EvalStr("5 < 10"));
30
<<Hello world>>
[[false]]
[[true]]
---
30
Hello world
false
true using uCalcSoftware; var uc = new uCalc(); // String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]] uc.Format("DataType: String, Def: val = '<<' + val + '>>' "); uc.Format("Bool, val = '[[' + val + ']]'"); // Shortcut notation without "DataType" or "Def" Console.WriteLine(uc.EvalStr("10+20")); Console.WriteLine(uc.EvalStr("'Hello '+'world'")); Console.WriteLine(uc.EvalStr("5 > 10")); Console.WriteLine(uc.EvalStr("5 < 10")); uc.FormatRemove(); Console.WriteLine("---"); Console.WriteLine(uc.EvalStr("10+20")); Console.WriteLine(uc.EvalStr("'Hello '+'world'")); Console.WriteLine(uc.EvalStr("5 > 10")); Console.WriteLine(uc.EvalStr("5 < 10"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]]
uc.Format("DataType: String, Def: val = '<<' + val + '>>' ");
uc.Format("Bool, val = '[[' + val + ']]'"); // Shortcut notation without "DataType" or "Def"
cout << uc.EvalStr("10+20") << endl;
cout << uc.EvalStr("'Hello '+'world'") << endl;
cout << uc.EvalStr("5 > 10") << endl;
cout << uc.EvalStr("5 < 10") << endl;
uc.FormatRemove();
cout << "---" << endl;
cout << uc.EvalStr("10+20") << endl;
cout << uc.EvalStr("'Hello '+'world'") << endl;
cout << uc.EvalStr("5 > 10") << endl;
cout << uc.EvalStr("5 < 10") << endl;
}
30
<<Hello world>>
[[false]]
[[true]]
---
30
Hello world
false
true #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]] uc.Format("DataType: String, Def: val = '<<' + val + '>>' "); uc.Format("Bool, val = '[[' + val + ']]'"); // Shortcut notation without "DataType" or "Def" cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; cout << uc.EvalStr("5 < 10") << endl; uc.FormatRemove(); cout << "---" << endl; cout << uc.EvalStr("10+20") << endl; cout << uc.EvalStr("'Hello '+'world'") << endl; cout << uc.EvalStr("5 > 10") << endl; cout << uc.EvalStr("5 < 10") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]]
uc.Format("DataType: String, Def: val = '<<' + val + '>>' ")
uc.Format("Bool, val = '[[' + val + ']]'") '// Shortcut notation without "DataType" or "Def"
Console.WriteLine(uc.EvalStr("10+20"))
Console.WriteLine(uc.EvalStr("'Hello '+'world'"))
Console.WriteLine(uc.EvalStr("5 > 10"))
Console.WriteLine(uc.EvalStr("5 < 10"))
uc.FormatRemove()
Console.WriteLine("---")
Console.WriteLine(uc.EvalStr("10+20"))
Console.WriteLine(uc.EvalStr("'Hello '+'world'"))
Console.WriteLine(uc.EvalStr("5 > 10"))
Console.WriteLine(uc.EvalStr("5 < 10"))
End Sub
End Module
30
<<Hello world>>
[[false]]
[[true]]
---
30
Hello world
false
true Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// String results will be surrounded by << and >>, while Boolean will be surrounded by [[ and ]] uc.Format("DataType: String, Def: val = '<<' + val + '>>' ") uc.Format("Bool, val = '[[' + val + ']]'") '// Shortcut notation without "DataType" or "Def" Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine(uc.EvalStr("5 < 10")) uc.FormatRemove() Console.WriteLine("---") Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine(uc.EvalStr("5 < 10")) End Sub End Module