In lab we’re going to write a program to execute postfix expressions using a queue and a stack. We’re also going to program using Codio, g++ and makefiles so everyone is familiar with these tools

computer science

Description

In lab we’re going to write a program to execute postfix expressions using a queue and a stack. We’re also going to program using Codio, g++ and makefiles so everyone is familiar with these tools. Follow the steps in this handout, and take advantage of the TAs if you need help. If you are unable to finish, feel free to return for another lab session.


A postfix expression is one where the operators follow the operands, e.g. 6 4 5 * –. This translates into the infix expression we are more commonly used to: 6 – (4*5), which evaluates to -14. If you want to experiment, an online postfix to infix translator is available here. Here are a few more examples:


The result, along with all operands, are integers. The operators are +, -, * and /. The latter is integer division, which truncates the result. 


Codio is cloud-based, and accessible via a web browser. It’s platform-neutral and works from any platform, but you must be online to use it. If you haven’t already, the first step is to create a Codio account and join the class (“CS 251 Fall 2019”):


Related Questions in computer science category