Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mathematical expression translator
#24
I tried this from QB > C. i made it do this:
  • put spaces between expressions and operators
  • find the ^
  • search left until it finds a space. if it sees a ) forget spaces until it comes to a (
  • put "pow(" in
  • do the same going right but add ")"
  • put spaces in again

the only error is that it searches from left to right so for:
    (5^5)^5
it returns:
    (pow( 5, 5) )pow( ,5)
but for something like this:
    5^5
it returns:
    pow(5,5)

it should look from the inside brackets to the outside brackets but i don't know how to do that.

    LPG   
     
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Reply


Messages In This Thread
Re: Mathematical expression translator - by Ralph - 04-23-2008, 05:40 AM
Re: Mathematical expression translator - by Ralph - 04-23-2008, 11:09 PM
Re: Mathematical expression translator - by Ralph - 04-24-2008, 02:56 AM
Re: Mathematical expression translator - by Ralph - 04-24-2008, 07:51 AM
Re: Mathematical expression translator - by Ralph - 04-25-2008, 07:40 PM
Re: Mathematical expression translator - by Ralph - 04-26-2008, 12:40 AM
Re: Mathematical expression translator - by Ralph - 04-26-2008, 04:33 AM
Re: Mathematical expression translator - by Ralph - 04-29-2008, 08:30 AM
Re: Mathematical expression translator - by LPG - 04-29-2008, 10:57 AM
Re: Mathematical expression translator - by LPG - 04-30-2008, 09:06 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)