# formula solver 4/7

``` BBS: Inland Empire Archive
Date: 03-13-93 (22:26)             Number: 337
From: QUINN TYLER JACKSON          Refer#: NONE
To: ALL                           Recvd: NO
Subj: formula solver 4/7             Conf: (2) Quik_Bas```
```'>>> Start of page 4.

SUB sqjApplyOp (Op\$, r, h)

' This is the meat of the operator section, and can be
modified to ' includ ANY symbol as an operator, or any two
byte symbol combination. ' Any symbol added has to be added
to the constant that sets its ' level of precedence.

SELECT CASE Op\$
CASE "-"    ' subtraction
r = r - h
CASE "+"    ' addition
r = r + h
CASE "*"    ' multiplication
r = r * h
CASE "/"    ' division
r = r / h
CASE "\"    ' integer division
r = r \ h
CASE "%"    ' modulo division
r = r MOD h
CASE "^", "**"  ' exponentation
r = r ^ h
CASE "]"    ' the rth root of h
r = h ^ (1 / r)
CASE "?"    ' random number from 0 to h, to r decimal places
r = (INT(RND * h * 10 ^ r)) / 10 ^ r
CASE "<<"   ' bitshift left h by r bits
r = INT(h) * 2 ^ INT(r)
CASE ">>"   ' bitshift right h by r bits
r = INT(h) \ 2 ^ INT(r)
CASE "<"    ' logical less than than
r = r < h
CASE "<=", "=<" ' logical less than or equal to
r = r <= h
CASE ">"    ' logical greater than
r = r > h
CASE ">=", "=>" ' logical greater than or equal to
r = r >= h
CASE "=="    ' logical equality
r = r = h
CASE "<>" ' logical inequality
r = r <> h
CASE "&"    ' bitwise AND
r = r AND h
CASE "|"    ' bitwise OR
r = r OR h
CASE "~"    ' bitwise XOR
r = r XOR h
END SELECT

END SUB

SUB sqjAssignVar (VarName\$, VarValue)

' First we see if this variable is already in the list
FOR i% = 1 TO VariPtr
IF VarMem(i%).Nom = VarName\$ THEN
' Since it was, just change its value
VarMem(i%).Valu = VarValu
EXIT SUB
END IF
NEXT i%

' Since it wasn't, put it there
VariPtr = VariPtr + 1

'>>> Continued on page 5.

--- Maximus/2 2.01wb
* Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)
```

Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET