Am I missing something? 
Author Message
 Am I missing something?

Quote:

> I'm currently writing a program using QBasic, in which I need
> to input a string from the user and convert it into a number.

> ie.  INPUT a$      ; where a$ may well be "(a-5000)/2 + (b-5001)*1999"

> Using VAL doesn't work, so can the string be evaluated relatively
> easily (assuming values for a and b are known)? Is there a command
> which I've overlooked?

> In the very old BBC Micro BASIC (probably not very familiar to
> people outside the UK), there was a command called EVAL which did
> exactly what I need.

Dear Steve,
  1st idea come to mind:

  Open a new .BAS file, and print the string (i.e. a$) into that .BAS
file. Then CHAIN to the file. The expression will then be evaluated by
QBasic. Then, by using some method of your own devising, return the result
back to your original program.

  As an alternative, you can write a stack-based procedure which convert
your infix expression into a postfix one. Then evaluate the postfix
expression (which is relatively easy). This topic should be covered in
many books on compiler-writing.

  Hope this helps. :-)

Eric

,-----------------------------------------------------------.
| Eric Tse                    Just An Occasional Net-Surfer |

`----   http://www.*-*-*.com/ ~jyetse/  ----'



Wed, 26 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Access Runtime - Am I Missing Something?

2. AM I missing something - Sum and Cumulative Sum

3. VBA For Dummies --- Am I missing something here?

4. Am I missing something?

5. Am I missing something incredibly easy?

6. Am I missing something in the DHTML Editor?

7. Undraggable controls: Am I Missing something???

8. Am I missing Something?

9. Am I missing something?

10. Am I missing something here ...? Instr Function

11. RegEx: Am I missing something?

12. Usercontrol properties - Am I missing something???

 

 
Powered by phpBB® Forum Software