Infix to Postfix

This is a discussion on Infix to Postfix within the C++ Programming forums, part of the General Programming Boards category; I am working on the last part of my conversion, evaluate the operator function alogorithm of my code called next ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    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 _
    public:
    stack_type( void );
    push( char Item );
    char pop(void );
    bool IsEmpty (void);

    private:
    char Stack[MAX_ITEMS];
    int ItemCount;

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

    Set done to false
    Repeat
    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
    Else
    Pop the operator stack
    If operator popped is (,
    Set done to true
    Else
    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
    Location
    Visalia, CA, USA
    Posts
    3,685

    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, 06: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, 01:17 PM
  4. Converting from infix to postfix
    By jcramer in forum C Programming
    Replies: 4
    Last Post: 03-27-2004, 08:23 PM
  5. Infix to Postfix
    By dat in forum C Programming
    Replies: 6
    Last Post: 06-16-2003, 08:46 AM

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