subject

Postfix evaluation In this assignment, you are to input an infix expression, convert it to
postfix (see the previous assignment - Posted below) and then evaluate it. You should
use a generic stack(i. e. a templated stack). Note: Ignore blank lines.
Input for the assignment:
2 + 3 * 5
2 + 3 * 5 ^ 6
2 + 3 - 5 + 6 - 4 + 2 - 1
2 + 3 * (5 - 6) - 4
2 * 3 ^ 5 * 6 - 4
(2 + 3) * 6 ^ 2
Sample output
1: 2 + 3 * 5
235*+
17
2: 2 + 3 * 5 ^ 6
2356^*+
46877
3: 2 + 3 - 5 + 6 - 4 + 2 - 1
23+5-6+4-2+1-
3
4: 2 + 3 * (5 - 6) - 4
2356-*+4-
-5
5: 2 * 3 ^ 5 * 6 - 4
235^*6*4-
2912
6: (2 + 3) * 6 ^ 2
23+62^*
180
You might also try:
7: ( ( ( ( 2 + 3 - 4 ) / 2 + 8 ) * 3 * ( 4 + 5 ) / 2 / 3 + 9 ) )
23+4-2/8+3*45+*2/3/9+
45
The Evaluation algorithm is as follows:
st = postfix_string
for (i=0; i < length(st); i++)
{
token = st[i]
switch (token)
{
digit :
push token
break

operator :
pop opn2
pop opn1
result = evaluate(opn1, token, opn2)
push result
break
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Afashion designer wants to increase awareness about her brand. which network can she use and why she can use the blank to blank her products online. answers for the first blank: internet, extranet, or intranet answers for the second blank: market, design, and export
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
3. what do the terms multipotentialite, polymath, or scanner mean?
Answers: 2
You know the right answer?
Postfix evaluation In this assignment, you are to input an infix expression, convert it to
po...
Questions
question
Mathematics, 09.12.2021 07:10
question
Advanced Placement (AP), 09.12.2021 07:10
question
Mathematics, 09.12.2021 07:10
question
Mathematics, 09.12.2021 07:10
question
Mathematics, 09.12.2021 07:10
Questions on the website: 13722363