I'm currently studying A-level computer science, and for my homework, I need to code a calculator with a GUI. It includes features like a customizable interface, graphing, and denary/binary conversion. The challenging part is that to achieve an A*, I have to implement reverse Polish notation (RPN) to allow multiple operations at once. The issue is that we haven't learned RPN or any data structures beyond arrays yet—my instructors just told us to research it ourselves. While I've grasped the concept of RPN, I'm having trouble translating the conversion from regular mathematical equations to RPN in code. I'd appreciate any tips or simplifications to tackle this problem!
3 Answers
I've been using RPN calculators since the '70s, and just a heads up, RPN itself doesn't allow executing multiple operations at once. Instead, it lets you push numbers onto a stack and perform operations on the top numbers, placing the results back on the stack. So, it’s more about the order of operations than running them all at once.
You need to clarify if your task is to implement RPN specifically or to convert standard infix notation to RPN. Those are two different things! It sounds like you need to convert infix to RPN, which is crucial for your calculator to handle multiple operations properly.
Yeah, we need to take infix input, convert it to RPN, and then output the result. Thanks for the clarification!
Check out the Shunting-Yard algorithm! It's a widely-used method for converting algebraic notation to RPN. Although it typically uses a stack, you can adapt it to work with arrays as well, which should help you with your assignment.

Got it! They didn't provide much detail, so I assumed I needed RPN for operations like '3 + 5 * 2'. I appreciate the input!