Devam Ediyor

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:

 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,

 Each operand is represented by a single digit (0 - 9) and

 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: +, -, *, /

 No unary operators are supported and

 An expression contains no embedded blank

 The input expressions are presumed to be valid.

Program requirements:

 Use the <stack> template as needed to solve this problem.

 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

Beceriler: Her şey Kabul, Makale Yeniden Yazım, C Programlama, PHP, Şablonlar

Daha fazlasını görün: writing file, writing motivation, writing expressions, writing problem statement example, writing problem statement, writing algebraic expressions, using numbers writing, using expressions, statement problem examples, statement problem example, statement problem sample, stack real life example, stack programming, sample stack program, rules writing numbers, real expressions, program problem statement, programming simplified, programming programing, programming life, programming expression, programing problem, programing programming, programing 1, problem statement writing

İş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