A simple example demonstrating a few of the most common math, logic, and string functions.
ID: 1183
using uCalcSoftware;
var uc = new uCalc();
Console.WriteLine($"Square root of 81 is: {uc.Eval("Sqrt(81)")}");
Console.WriteLine($"Is 10 greater than 5? {uc.EvalStr("IIf(10 > 5, 'Yes', 'No')")}");
Console.WriteLine($"String length: {uc.Eval("Length('uCalc rocks!')")}");
Square root of 81 is: 9
Is 10 greater than 5? Yes
String length: 12 using uCalcSoftware; var uc = new uCalc(); Console.WriteLine($"Square root of 81 is: {uc.Eval("Sqrt(81)")}"); Console.WriteLine($"Is 10 greater than 5? {uc.EvalStr("IIf(10 > 5, 'Yes', 'No')")}"); Console.WriteLine($"String length: {uc.Eval("Length('uCalc rocks!')")}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
cout << "Square root of 81 is: " << uc.Eval("Sqrt(81)") << endl;
cout << "Is 10 greater than 5? " << uc.EvalStr("IIf(10 > 5, 'Yes', 'No')") << endl;
cout << "String length: " << uc.Eval("Length('uCalc rocks!')") << endl;
}
Square root of 81 is: 9
Is 10 greater than 5? Yes
String length: 12 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; cout << "Square root of 81 is: " << uc.Eval("Sqrt(81)") << endl; cout << "Is 10 greater than 5? " << uc.EvalStr("IIf(10 > 5, 'Yes', 'No')") << endl; cout << "String length: " << uc.Eval("Length('uCalc rocks!')") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Console.WriteLine($"Square root of 81 is: {uc.Eval("Sqrt(81)")}")
Console.WriteLine($"Is 10 greater than 5? {uc.EvalStr("IIf(10 > 5, 'Yes', 'No')")}")
Console.WriteLine($"String length: {uc.Eval("Length('uCalc rocks!')")}")
End Sub
End Module
Square root of 81 is: 9
Is 10 greater than 5? Yes
String length: 12 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Console.WriteLine($"Square root of 81 is: {uc.Eval("Sqrt(81)")}") Console.WriteLine($"Is 10 greater than 5? {uc.EvalStr("IIf(10 > 5, 'Yes', 'No')")}") Console.WriteLine($"String length: {uc.Eval("Length('uCalc rocks!')")}") End Sub End Module