SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 385.3k

Stacks -Converting Postfix Expression to Infix Expresion C++

Oct 21 2013 5:24 PM

Hi


Write a program write a program called "infix.cpp", that uses a stack to convert a postfix expression to the corresponding fully-parenthesized infix expression. Consider the following examples:

  1. the postfix expression a b + c d - * will be converted to the infix ((a + b) * (c - d))
  2. the the postfix expression a b + will be converted to the infix (a + b)
  3. the postfix expression a b / c d / / will be converted to infix ((a / b) / (c / d))

Your program should ask the user for a postfix expression as input, and it should output the corresponding fully-parenthesized infix expression. The program should also ask the user if he/she would like to do another conversion. If so, the user should be able to enter another posfix expression; otherwise the program should terminate. Also, the stack must be implemented using a singly-linked list. Your driver, infix.cpp, should include the definition and declaration files for the class STACK, stack.cpp and stack.h, respectively.

**Using CodePad is helpful to understand your code.

Otherwise just submit your code neatly (understandable)

THANK YOU!


Answers (10)