Case Study: A Reverse-Polish Calculator
The first serious scientific calculators made by Hewlett-Packard had an eccentric way of entering expressions backward. You entered the numbers and then applied the operation. It is a classic use of the stack idea: Two numbers are pushed onto the stack, and then a multiply function operates on these numbers and replaces them with the result. Hewlett-Packard's many fans claimed that they could type in expressions faster than people using good old-fashioned infix notation because they did not need parentheses. Infix notation puts the operator between the operands, like 10 + 20. Reverse Polish Notation (RPN—Polish as in the nationality) writes the operator afterward, like 10 20 +. A surprisingly popular programming ...
Get C++ By Example: UnderC Learning Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.