CMSC 162 -- Lab 9

Lab 9

Getting Started

Log onto a computer science server making sure to change the port number.

Follow these instructions to get your files ready to start lab.
  • Use wget to download the file at http://cs.longwood.edu/courses/cmsc162/f18/files/lab9.tgz
  • Uncompress the lab9.tgz file by using tar -xvzf lab9.tgz
  • Use cd lab9 to change directory to the lab9 directory

The Problem

You will write a program to translate postfix notation(RPN) into both inFix notation and preFix notation. You will build a parse tree made from Node structures. To build the parse tree you will use a stack.
  1. Use STL stacks
  2. Recursive functions working on structures
  3. Building trees
  4. Traversing trees

Implementation

You have been given a file named translate.cpp which contains your main and a Node struct. You will parse the string in the loop in main. If the current token is a number it will be stored in a node and pushed onto the stack. If the token is an operation it will be stored into a node and the top two things on the stack will be stored in the left and right branches.

Handin

When you are done you need to hand in your lab. The easiest way is to type make handin.

You lab is due at 11:59pm Nov. 6th 2018.