BBS: Inland Empire Archive Date: 06-09-92 (19:33) Number: 124 From: MATT HART Refer#: NONE To: GLENN KINEN Recvd: NO Subj: Qbasic 1.0?????? Conf: (2) Quik_Bas
GK> i tried it, and inputted ... 2*2, it said "Redo from start". I entered
GK> Why can't I input a multiplication problem?
GK> Is there a command for this?
No, no command, never has been in BASIC or any other
language. There are routines which will translate formulas
- QuickPak Pro has the "Evaluate" procedure. You must make
one yourself for QBasic. Something like:
INPUT "Formula ";A$ '<< Note a string
PRINT "Working..."
' A$ = "2*2"
Num# = 0#
i = 1
DO
L$=MID$(A$,i,1)
IF VAL(L$) > 0
j=i
DO
j=j+1
IF j > LEN(A$) THEN EXIT DO
IF VAL(MID$(A$,i,1)) = 0 THEN EXIT DO
LOOP
L$ = MID$(A$,i,j-i+1)
Num# = VAL(L$)
ELSE
SELECT CASE L$
CASE "*" ' times
END SELECT
ENDIF
i = i + 1
LOOP UNTIL i > LEN(A$)
This kind of formula evaluation can get really, really
involved. But it is what you would have to do...
---
* Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)

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