University of Washington, Bothell
CSS 263: Programming and Discrete Mathematics
Fall 2009
Laboratory 4
Monday, October 26, 2009
Getting to know queue, getting to know all about queue
The goal of this laboratory is to gain familiarity with the “circular array” implementation of a queue. We will be
starting with Weiss’ queue implementation, which includes dynamic reallocation when the queue fills
up.
- So, first, download the files: QueueAr.h, QueueAr.cpp, TestQueueAr.cpp, Except.h,
- Get rid of the #include "StartConv.h" and #include "EndConv.h" in those files. Also, change lines
like #include "vector.h" to #include <vector>, plus add using namespace std; after that line.
- Next, verify that you can compile and run the TestQueueAr program.
- Answer the following question: what are lines 8–10 in Figure 16.15 doing? For those that don’t have
the text with them, those lines are the for loop and the line back += currentSize; in doubleQueue.
- Modify the constructors so that it takes an optional parameter specifying the initial queue capacity.
Note that vector has a constructor you may find useful in this task.
- Implement operator=. Test to make sure that code like Q = Q; in your test program works.
Please submit a printout of your final .h and .cpp files, the output of your final test run, and your
answer to question 4 above. Remember to write the names of all group members on what you hand
in.