Thread: Infix to Postfix

  1. #1
    Registered User
    Join Date
    Dec 2002

    Infix to Postfix

    I am working on the last part of my conversion, evaluate the operator function alogorithm of my code called next op. I have it written out on paper but I am having problems converting it to code.

    I have this class included in my program
    class stack_type _
    stack_type( void );
    push( char Item );
    char pop(void );
    bool IsEmpty (void);

    char Stack[MAX_ITEMS];
    int ItemCount;

    This is the alogorithm I need help coding. It is in my main function:

    Set done to false
    If operator stack is empty or next operator is ),
    Push next operator onto stack and set done to true
    Else if precedence (next operator) > precedence(top operator)
    Push next operator onto the stack
    (ensures higer precedence operators evaluated first)
    Set done to true
    Pop the operator stack
    If operator popped is (,
    Set done to true
    Pop right and left from operand stack
    Evaluate left operator right
    Push result onto operand stack
    Until Done

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA

    Re: ascii

    I'd love to help you but part of learning is trying to do things on your own. At least get something that compiles posted here and then we will help you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expression: Convert infix notation to postfix notation.
    By Nutshell in forum C Programming
    Replies: 7
    Last Post: 02-27-2010, 07:44 AM
  2. Infix, Postfix, Pseudo-Calculator using Stack ADT
    By sangken in forum C Programming
    Replies: 9
    Last Post: 09-08-2006, 08:17 AM
  3. Replies: 4
    Last Post: 03-12-2006, 02:17 PM
  4. Converting from infix to postfix
    By jcramer in forum C Programming
    Replies: 4
    Last Post: 03-27-2004, 09:23 PM
  5. Infix to Postfix
    By dat in forum C Programming
    Replies: 6
    Last Post: 06-16-2003, 08:46 AM