For this project, you will read an infix expression, convert it to postfix, evaluate the postfix expression, and print out the answer. You will need to define and implement your own Stack class and a Calculator class. Your Stack class should support standard stack operations, which you can implement with either a linked list or an array. You should use a class template Stack in C++, but an integer Stack class would work as well since a character would be considered a subset of integers. Your Calculator class stores an infix operation and it provides the public operations below. Feel free to add private operations and data. The Calculator class should use a character stack to convert infix to postfix (storing operators) and then uses an integer stack to evaluate the expression (storing operands).
For this project, you will read an infix expression, convert it to postfix, evaluate the postfix expression, and print out the answer. You will need to define and implement your own Stack class and a Calculator class. Your Stack class should support standard stack operations, which you can implement with either a linked list or an array. You should use a class template Stack in C++, but an integer Stack class would work as well since a character would be considered a subset of integers. Your Calculator class stores an infix operation and it provides the public operations below. Feel free to add private operations and data. The Calculator class should use a character stack to convert infix to postfix (storing operators) and then uses an integer stack to evaluate the expression (storing operands).
C++ ( I WILL THUMBS DOWN IF YOU USE HJAVA)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images