Expression Evaluation using Stacks First, get the file [login to view URL] that will serve as your input. This is a file with each line being an integer algebraic expression that you will evaluate. Print each expression and its value, one per line. Setup an ADT Stack type (based on a linked list) so you can have a stack of integers whenever you need one. The expressions consist of integer constants and operators +, -, *, /, ( and ). Multiplication and division are to have higher precedence than addition and subtraction. Generally, a stack is used in this process. There are 2 main steps in evaluating an expression. First, you need to translate the expression from infix to postfix. For example, a * (b + c) is an infix expression whose postfix equivalent is a b c + *. Computers like postfix expressions because they are VERY easy to evaluate (which is your second step). To evaluate a postfix expression, setup a stack of ints and scan the string from left to right. Push any data value onto the stack. When you see an operator, apply it to the top 2 stack values, pushing the result back onto the stack. At the end, the top of the stack will be the value of the whole expression. First, however you need to translate infix to postfix. A stack is used here as well. Here is the algorithm: Scan the infix string from left to right. When you see a digit, collect any more adjacent digits into one integer value and simply place that value directly into the postfix string you are building. Other non-blank characters are handled as follows: (Let c = the character in question): if c is + - * / or ) then while stack is not empty and precedence(c) <= precedence(TOS) pop the stack add the popped value to the end of the postfix string if not ( end while if c is not ) then push c onto stack else if stack is not empty, pop it end if if c is (, just push it. After you are done scanning the infix string, you need to pop remaining operators off the stack, as with while stack not empty pop the stack add the popped value to the end of the postfix string if not ( end while The 'precedence' function is just an int returning function that you write. It takes a char c input parameter and bascially returns 1 if C is + or -, 2 if c is * or / and 0 if c is anything else.
## Deliverables
Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased.
## Platform
Please write this program in C++, I use the Visual C++ 6.0 to compile and run it.
## Deadline information
please deliver the codes ontime