Expression Evaluator Contest

This is a discussion on Expression Evaluator Contest within the Contests Board forums, part of the Community Boards category; Speaking of which, what operators must the thing support, and what are the precedence rules it must follow?...

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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
    C Programmer Stack Overflow's Avatar
    Join Date
    Apr 2004
    Posts
    477
    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
    C Programmer Stack Overflow's Avatar
    Join Date
    Apr 2004
    Posts
    477
    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
    C Programmer Stack Overflow's Avatar
    Join Date
    Apr 2004
    Posts
    477
    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.

Page 2 of 2 FirstFirst 12
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-20-2007, 12:37 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03: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, 11:03 AM
  5. Help! Program to evaluate expression...
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-19-2002, 06:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21