Thread: Expression Manipulator v0.1

  1. #16
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Yes, I know those circumventions are possible, but the computer should adapt to the user, not vice verca.
    The user should not have to remember to add an extra space after a minus sign.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #17
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    (a+b)(c+d) does work fine. In some situations the parentheses surrounding the expression don't show when they should, so I'll have to tweak that.

    x(a+b) isn't allowed because x() is handled like a function. Graphing calculators have the same problem. The only way I can see to allow that is to differentiate between functions and variables at run-time, which means pre-defining the names of each before using them.

    I might be able to tweak minus signs to work correctly in situations. Graphing calculators solve this problem by having a different minus sign than their negative sign. Anyone have any ideas for rules regarding the dash? (ie: if letter before and afterwards, it's a minus sign)

  3. #18
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Wouldn't it always be possible to interpret it as a negative sign?

    4-n = 4+(-n)
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #19
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Originally posted by XSquared
    Wouldn't it always be possible to interpret it as a negative sign?

    4-n = 4+(-n)
    But that could also be
    4-n = 4(-n)

  5. #20
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Most people would probably write that as 4*-n though, or use 4(-n). I don't think anyone would type 4-n and intend 4 times negative n.

    edit: impressive program anyway
    Last edited by confuted; 05-18-2003 at 02:14 PM.
    Away.

  6. #21
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    so... ignoring whitespace, it's a minus sign unless
    1) It's preceded by a plus sign
    2) it's preceded by a parenthesis
    3) it's the first character in the string
    4) it's preceded by a '*'

    This sound good?

    thanks for your input, btw

  7. #22
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    That sounds excellent
    Away.

  8. #23
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    So you can't divide by a negative number, according to your rules...
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #24
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Originally posted by XSquared
    So you can't divide by a negative number, according to your rules...
    5) It's preceded by a '/'

    BTW, the '/' serves to raise the next factor in the string by -1 power. Negative signs are skipped past, because there's never any intention to divide just by a negative 1.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with making a Math Expression DLL
    By MindWorX in forum C Programming
    Replies: 19
    Last Post: 07-19-2007, 11:37 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. recursion error
    By cchallenged in forum C Programming
    Replies: 2
    Last Post: 12-18-2006, 09:15 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. Expression Evaluator Contest
    By Stack Overflow in forum Contests Board
    Replies: 20
    Last Post: 03-29-2005, 10:34 AM