# 516180 C++ Programing

Problem statement:

Evaluate an infix algebraic expression by converting the infix expression to postfix expression and then evaluate the postfix expression using stack. A data file (for example, “[url removed, login to view]”) contains the list of expressions to be evaluated, one expression per line. You can assume that operands are single digit positive numbers.

Motivation: Postfix notation is a way of writing algebraic expressions without the use of parentheses or rules of operator precedence.

Requirements:

&#61623; Process infix expressions stored in a file read interactively (for example “[url removed, login to view]”). For each expression in the file:

o Print the infix notation read from the file

o Print the corresponding postfix notation

o Print the result of the evaluation

Assumption: In our simplified examples,

&#61623; Each operand is represented by a single digit (0 - 9) and

&#61623; Each operator by a single character.

o These are called tokens. Things are more complicated in real life.

o Operands and some operators, like ** for exponentiation, require more than a single character. However, we can make these simplifications without loss of generality.

o List of operators to be handled: +, -, *, /

&#61623; No unary operators are supported and

&#61623; An expression contains no embedded blank

&#61623; The input expressions are presumed to be valid.

Program requirements:

&#61623; Use the &lt;stack&gt; template as needed to solve this problem.

&#61623; Create functions as needed to make the program modular

Sample output:

Infix postfix evaluation

1. 2+5 2 5 + 7

2. 9*3 9 3 * 27

3. 3+4+5 3 4 + 5 + 12

4. 3*4+5 3 4 * 5 + 17

5. 3+4*5+6 3 4 5 * + 6 + 29

6. (3+4)*5 3 4 + 5 * 35

7. (9-2)*3 9 2 – 3 * 21

8. ((2+3)*4)*5 2 3 + 4 * 5 * 100

9. 2-(3*(4+5))+6 2 3 4 5 + * - 6 + -19

İşveren Hakkında:
( 6 değerlendirme ) Nashville,

Proje NO: #2262112

## Seçilen:

eperfections

Lets do it now

0 gün içinde 30\$ USD
(366 Değerlendirme)
7.1