CISC220 F2014 Lab3

From class_wiki
Jump to: navigation, search

Lab #3

The Drozdek references below are to the textbook. It shouldn't matter whether you have the 3rd or 4th edition.

1. C++ programming exercises

  • (3 points) Drozdek programming assignment 4.10.3 (4.9.3 in 3rd edition): Implement the stack-based delimiter matching algorithm from Drozdek Section 4.1. As in the algorithm, you should read from a file and handle parentheses, square brackets, curly braces, and C++ comments (/* and */ pairs), and skip all other characters that may be mixed in. Use the STL stack class. You may do everything in main.cpp.
    • To use the STL stack, you must have "#include <stack>" in your main.cpp. Also be aware that this class separates pop() and top() into separate functions, so you will need to use top() to "read" what is about to be popped.
  • (2 points) Modify this array_queue class to be circular as defined in Drozdek Chapter 4.2. You may refer to the code in figure 4.9, but what you submit should be based on array_queue. Also, please use variable names back for where things are enqueued and front for where they are dequeued as discussed in class. Don't change main.cpp; you should be able to run it to verify that your modified class still works.
    • If you have problems with the lines in the #ifdef LINUX sections of main.cpp, just comment out #define LINUX at the top. The only purpose of these lines is to put a delay after each queue element getting printed.

2. Submission

  • Include a PDF file <Your Name>_README.pdf which contains the inputs and outputs of your delimiter matching program and several test strings being printed out for your circular array queue program.
  • Create a single tar/zip/rar file out of the top-level and all subdirectories. This archive file should be named <Your Last Name>_Lab3.tar (or .zip or .rar, etc.).
  • Submit it in Sakai by midnight at the end of Thursday, September 18