Dim VariableX = uc.DefineVariable("x")
Dim Expression As string
Console.Write("Enter an expression (Ex: x^2 * 10): ")
Expression = Console.ReadLine()
Dim ParsedExpr = uc.Parse(Expression)
Dim x As double
for x = 1 To 10
VariableX.SetVariableValue(x)
Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate())
Next
' Output
' x = 1 Result = 10
' x = 2 Result = 40
' x = 3 Result = 90
' x = 4 Result = 160
' x = 5 Result = 250
' x = 6 Result = 360
' x = 7 Result = 490
' x = 8 Result = 640
' x = 9 Result = 810
' x = 10 Result = 1000
ParsedExpr.Release()
VariableX.Release()
var VariableX = uc.DefineVariable("x");
string Expression;
Console.Write("Enter an expression (Ex: x^2 * 10): ");
Expression = Console.ReadLine();
var ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate());
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
//var VariableX = uc.DefineVariable('x');
Write('Enter an expression (Ex: x^2 * 10): ')
Expression = ReadLn();
//var ParsedExpr = uc.Parse(Expression);
for x := 1 to 10 do
begin
VariableX.SetVariableValue(x);
WriteLn('x = ' + x + ' Result = ' + ParsedExpr.Evaluate());
End;
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
auto VariableX = uc.DefineVariable("x");
string Expression;
cout << "Enter an expression (Ex: x^2 * 10): " << endl;
cin >> Expression; // Ex: x^2 * 10
auto ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
cout << "x = " << x << " Result = " << ParsedExpr.Evaluate() << endl;
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
auto VariableX = uc.DefineVariable("x");
string ^ Expression;
Console::Write("Enter an expression (Ex: x^2 * 10): ");
Expression = Console::ReadLine();
auto ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
Console::WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate());
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
Dim var = uc.DefineVariable("Var")
Dim ByteVar = uc.DefineVariable("ByteVar As Int8")
Dim Int16uVar = uc.DefineVariable("Int16uVar As Int16u")
Dim Int32uVar = uc.DefineVariable("Int32uVar As Int32u")
Dim Int64uVar = uc.DefineVariable("Int64uVar As Int64u")
Dim SingleVar = uc.DefineVariable("SingleVar As Single")
Dim DoubleVar = uc.DefineVariable("DoubleVar As Double")
Dim StringVar = uc.DefineVariable("StringVar As String")
var.SetVariableValue(1.25)
ByteVar.SetVariableValueByte(255)
Int16uVar.SetVariableValueInt16(-1)
Int32uVar.SetVariableValueInt32(-1)
Int64uVar.SetVariableValueInt64(-1)
SingleVar.SetVariableValueSng(1.5)
DoubleVar.SetVariableValueDbl(2.5)
StringVar.SetVariableValueStr("Test")
Console.WriteLine("Var value: " + uc.EvalStr("Var")) ' Returns "Var value: 1.25"
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")) ' Returns "ByteVar value: -1"
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")) ' Returns "Int16uVar value: 65535"
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")) ' Returns "Int32uVar value: 4294967295"
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")) ' Returns "Int64uVar value: 18446744073709551615"
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")) ' Returns "SingleVar value: 1.5"
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")) ' Returns "DoubleVar value: 2.5"
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")) ' Returns "StringVar value: Test"
var var = uc.DefineVariable("Var");
var ByteVar = uc.DefineVariable("ByteVar As Int8");
var Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
var Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
var Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
var SingleVar = uc.DefineVariable("SingleVar As Single");
var DoubleVar = uc.DefineVariable("DoubleVar As Double");
var StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
Console.WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";
//var Var = uc.DefineVariable('Var');
//var ByteVar = uc.DefineVariable('ByteVar As Int8');
//var Int16uVar = uc.DefineVariable('Int16uVar As Int16u');
//var Int32uVar = uc.DefineVariable('Int32uVar As Int32u');
//var Int64uVar = uc.DefineVariable('Int64uVar As Int64u');
//var SingleVar = uc.DefineVariable('SingleVar As Single');
//var DoubleVar = uc.DefineVariable('DoubleVar As Double');
//var StringVar = uc.DefineVariable('StringVar As String');
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng(1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr('Test');
WriteLn('Var value: ' + uc.EvalStr('Var')); // Returns 'Var value: 1.25';
WriteLn('ByteVar value: ' + uc.EvalStr('ByteVar')); // Returns 'ByteVar value: -1';
WriteLn('Int16uVar value: ' + uc.EvalStr('Int16uVar')); // Returns 'Int16uVar value: 65535';
WriteLn('Int32uVar value: ' + uc.EvalStr('Int32uVar')); // Returns 'Int32uVar value: 4294967295';
WriteLn('Int64uVar value: ' + uc.EvalStr('Int64uVar')); // Returns 'Int64uVar value: 18446744073709551615';
WriteLn('SingleVar value: ' + uc.EvalStr('SingleVar')); // Returns 'SingleVar value: 1.5';
WriteLn('DoubleVar value: ' + uc.EvalStr('DoubleVar')); // Returns 'DoubleVar value: 2.5';
WriteLn('StringVar value: ' + uc.EvalStr('StringVar')); // Returns 'StringVar value: Test';
auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
cout << "Var value: " << uc.EvalStr("Var") << endl; // Returns "Var value: 1.25";
cout << "ByteVar value: " << uc.EvalStr("ByteVar") << endl; // Returns "ByteVar value: -1";
cout << "Int16uVar value: " << uc.EvalStr("Int16uVar") << endl; // Returns "Int16uVar value: 65535";
cout << "Int32uVar value: " << uc.EvalStr("Int32uVar") << endl; // Returns "Int32uVar value: 4294967295";
cout << "Int64uVar value: " << uc.EvalStr("Int64uVar") << endl; // Returns "Int64uVar value: 18446744073709551615";
cout << "SingleVar value: " << uc.EvalStr("SingleVar") << endl; // Returns "SingleVar value: 1.5";
cout << "DoubleVar value: " << uc.EvalStr("DoubleVar") << endl; // Returns "DoubleVar value: 2.5";
cout << "StringVar value: " << uc.EvalStr("StringVar") << endl; // Returns "StringVar value: Test";
auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
Console::WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console::WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console::WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console::WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console::WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console::WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console::WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console::WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="SetVariableValue")> _
Private Sub SetVariableValue__(ByVal ItemHandle As IntPtr,ByVal Value As Double)
End Sub
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="SetVariableValue")]
protected static extern void SetVariableValue_(IntPtr ItemHandle, double Value);
{DLLImport}procedure SetVariableValue__(ItemHandle: System.Pointer;Value: Double); cdecl; external uCalcDLL name 'SetVariableValue';
typedef void (* __SetVariableValue)(void *ItemHandle, double Value);
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "SetVariableValue")]
static void SetVariableValue_(void * ItemHandle, double Value);