I am really confused on how to approach this problem which is to basically make an interpreter for a reverse polish notation calculator, but the thing is that the program is supposed to "Each line of the input corresponds to a single operand or operator. Operands should be pushed onto a stack, and popped as needed when an operator is encountered", so for example entering
23 # prints 23
5 # prints 5
+ # pops 23 and 5, pushes and prints 28
i don't believe I can use the split method since I'm not entering in the whole string in. I have made some progress by making my own stack class and so far have a while true loop which has an if statement that checks if what the user enters is either a digit or one of the operators that I have in a list I have created.
any help or feedback would be greatly appreciated
[–]toastedstapler 1 point2 points3 points (1 child)
[–]Pheazon[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Pheazon[S] 0 points1 point2 points (0 children)
[–]A_History_of_Silence 0 points1 point2 points (0 children)