plugin-lab03 - CS 2150 Laboratory 3 Stacks Week of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 2150 Laboratory 3 Stacks Week of September 14, 2009 Objective: To understand the workings of a stack as well as postfix notation, and to be introduced to the STL library Background: A stack is a basic data structure similar in use to a physical stack of papers. You can add to the top (push) and take from the top (pop), but you are not allowed to touch the middle or bottom. A stack adheres to the LIFO property. Reading(s): 1. Finish Weiss, Data Structures , Chapter 3. 2. Weiss, Data Structures , Section 1.4.4 on vectors and strings. 3. Weiss, C++ for Java Programmers , Section 2.2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 2150, fall 2009 Page 2 of 10 Procedure Pre-lab 1. Read this entire lab document before coming to lab. 2. Go through the first half of the Unix tutorial found in the Collab workspace (in the “03-04-more- unix” directory – the “01-unix-tutorial” directory is from lab 1). Start at the ‘index.html’ page. This tutorial is originally from the department of Electrical Engineering at the University of Surrey at You should complete the introductory part and sections 1-4. You will be somewhat familiar with some of the materials in the first few of these tutorials, as it was in the Unix tutorial from the first lab. The rest of the tutorial (sections 5-8) are for next week’s lab, but feel free to go through it this week, if you are interested. 3. Write up at least one question that you still have on Unix (or things you are still confused about) into unix.questions.txt. 4. Your code for the pre-lab will use the pre-existing STL stack class. The STL is the Standard Template Library, and is a collection of useful routines analogous to the routines in Java’s SDK (it contains a vector class, for example). To use the stack STL class, just put #include <stack> at the top of your C++ file. A standard g++ installation should automatically find the STL stack class (this works in Linux and Cygwin, for example). Information on the STL stack class can be found in Chapter 10 of Weiss’ C++ for Java Programmers . Documentation on the STL routines can be found at . 5. Implement a simple postfix stack calculator for integers using your stack. You should use the STL stack class , rather than implement your own. A simple postfix stack calculator for integers is described on pages 97-99 in Weiss’ Data Structures book. Implement this into postfixCalculator.h and postfixCalculator.cpp Create a simple test driver, testPostfixCalc.cpp, which will be used to demonstrate your calculator. See the specifications in the pre-lab section for how to handle the input. The last page of this document has some sample test cases you can use. 6.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 10

plugin-lab03 - CS 2150 Laboratory 3 Stacks Week of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online