Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTES: This is a post-fix evaluation, the input is an external file named input.dat and the language to program this in is C++. Thanks You
NOTES: This is a post-fix evaluation, the input is an external file named "input.dat" and the language to program this in is C++. Thanks
You are to input an infix expression, convert it to postfix and then evaluate it. You should use a generic stack(i.e. a templated stack). Note: Ignore blank lines. Input for the assignment: "input.dat" [external file] 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started