http://www.cs.tufts.edu/comp/15/labs/lab1In this lab you will build a simple queue of names, implemented as a linked list of strings. The goal of the lab is to get your programming skills warmed up, and to give you some code to start with when the first programming project is assigned (soon!)
Start by copying three files from /comp/15/labs/lab1 into your
home directory (I recommend making a subdirectory called comp15 with another
directory inside it called lab1). The three files are:
queue.h: a header file for the Queue class. This file serves as
the interface, and does not include definitions of the methods. You should not
need to modify this file at all.queue.cpp: the implementation of the Queue linked list. This
file is mostly empty -- your job is to add implementations for the methods
in queue.hmain.cpp: a main function to test you queue. Feel free to edit
this code to test more cases.You can copy them in one command:
cp /comp/15/labs/lab1/* .
Edit, Save, and Compile Often!!!
You can use one of two compilers: g++ or clang++. I recommend using clang++ because it gives much better error messages.
clang++ main.cpp queue.cpp -o mytest
To debug your code (especially if you have segmentation faults) you can
use gdb
(see my quick
reference on using the debugger). I also urge you to try running your
program using valgrind, a very cool program that checks your
program for pointer and allocation problems. Run it like this:
valgrind ./mytest
As always, you should provide your source code before
you leave. The assignment name is lab1.
provide comp15 lab1 sequence.cpp main.cpp