// uCalc Console Calculator 3.00
// www.ucalc.com
//
// See WhatsNew.Txt for new features in the current version.
//
// uCalc Console Calculator 3.00 is a powerful calculator with a simple console
// interface.  It uses the same parser/language builder engine as other uCalc
// products.  The code that represents the math "language" used in this
// calculator can be mostly found in uCalc.uc and dependent files, which are
// in the zip files for some of the other uCalc products.  Some additional code
// beyond uCalc.uc was added to the executable for the Solve() and Sum() functions.
// Those two are based on code found in the demo for uCalc Fast Math Parser.
// There is also some code for implied variable definition (so you don't have to
// explicitly declare variables before use), based somewhat on the error handler in
// Basic.uc.
//
// IMPORTANT: String routines from uCalc String Library override the ones in
// Strings.uc.  If two routines have the same name, the one from uCalc String Library
// is executed.  This means for instance that Len(MyStr) by default would return the
// number of tokens.  For number of characters, use Len(MyStr, ucChar).  If you
// uncomment the line in uCalc.Def that says ucRename("Len", "TokenCount"), Len()
// will revert to the character count definition and TokenCount will count tokens.
//
// Below are examples you can try with uCalc Console Calculator 3.00.  You can either:
//    A. Type uCalc followed by an expression at the Windows Command Prompt:
//
//       C:\> uCalc 3+4*2
//
// Or B. Run uCalc and enter expressions at the uCalc prompt:
//
//       C:\> uCalc
//       > 3+4*2
//
// Or C. Have uCalc evaluate a group of expressions by passing a file (such as this one) as
//       input and redirecting the output to another file at the Windows Command Prompt:
//
//       C:\> uCalc < ReadMe.Txt > Results.Txt
//

5-4*(7.25+2.75)

Solve(x^2 + 50 = 150)

Solve(x^2 + 50 = 150, -1000, 0)

Solve(x^2 = 25, 100, 200)

Sum(x^2 + 25, 1, 50)

q = 25

q*2+10

g(x) = x - 1

Factorial(x) = IIf(x>1, x*Factorial(x-1), 1)

Factorial(g(12) - 5) + 10

TriangleWave(x) = (8/pi^2)*Sum((-1)^((n-1)/2)/(n^2)*Sin(n*x*pi), 1, 100, 2, n)

#Def Const: Tab As String = Chr(9)

uc_For(x, 1, 10, 0.25, WriteLn(Str(x) + Tab*4 + Str(CInt(TriangleWave(x)*10)/10)))

#Def Func: Area(Length, Width) = Length * Width
#Def Func: Area(side) = side ^ 2

Area(5, 10) + Area(3)

#B11011111 OR #B10111001

#H1EFF + 25

"Hello " * 3

Rand(25, 100)

Max(1,5+4, 3+2, 89.7, 123/7, -5, 17.5)
@ * 100

#Def Var: UserName As String

UserName = "John"

UpperCase("Hello " + UserName)
LowerCase($)

Dim abc = 123, MyString As String

Retain("<html> code <p> etc </p> 1234 </html>", "<{tag}>")  // <html><p></p></html>

UCase("Only words (in parenthesis) changed", "({text})")    // Only words (IN PARENTHESIS) changed

Range(1, 20, "x^2", Delim(","))

#Expand Var: MyVar

#Steps Var: MyVar

#Def RunFile: TestFile.Txt

MsgBox "This is a test of the MsgBox command."

TypeName("UserName")      // Returns the name of the data type for UserName

TypeName("abc")

File("uCalc.Def")         // Returns the contents of uCalc.Def

ucSymbols                 // Returns list of defined symbols (both user and predefined)

