Thread: Expression Evaluator Contest

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Speaking of which, what operators must the thing support, and what are the precedence rules it must follow?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Hello,

    The standard operators are +, -, *, /, !, and ^; where ^ represents the exponential operator, and ! represents factorial.

    The link I provided earlier has a figure that shows Operator Precedence in descending order. Also, in an infix expression, the operators do not appear (from left to right) in the order in which they are to be carried out. Instead, we use parentheses and precedence rules to indicate the order in which they should be done. In the absence of parentheses, the following precedence rules are in effect:
    • Exponentiation has the highest precedence. Perform exponentiations in order first, from left to right.
    • Multiplication and division have the next-highest precedence. After performing all exponentiations, perform multiplications and divisions in order, from left to right.
    • Addition and subtraction have the lowest precedence. After performing all multiplications and divisions, perform additions and subtractions in order, from left to right.

    In actuality, exponentiation is right-associative, but we'll keep things simple.


    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  3. #18
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    My solution was emailed to you. I view it as a no-nonsense response. Thanks for the challenge.
    You're only born perfect.

  4. #19
    Hello,

    Submission received. Thanks for participating.


    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  5. #20
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Did you recieve my submission as well?

    I submitted the old code, I wasn't even able to make it compile on VC++.NET.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #21
    Hello,

    Well, I just checked my eMail this morning, and I did receive it. Heh, it's getting close to the deadline; it's time I grade all of the submissions. I'm about to look over the eMail.

    Thanks for participating


    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

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. Help! Program to evaluate expression...
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-19-2002, 06:20 AM