This lab will have you do the hard labor of reproducing a C++ implementation of the Vector ADT. The implementation closely follows the one in Chapter 2 of Weiss, Data Structures and Algorithm Analysis in C++. However, the instructor made a few modifications:
o We will not use C++ exceptions at this time; instead, we will use assert statements from the <cassert> STL. o We will write <typename T> instead of <typename Object>.
Exercise1: Implement the Vector class in a file Vector.cpp exactly as shown on the pages at the end of this document.
Exercise 2: Test your Vector implementation with the Median and MaxSubSum programs from the lecture notes. The provide programs use the STL <vector> library. Replace line #include <vector> with #include Vector.h and compile and run these programs with the home-made Vector class. It should work
Credit for this Lab: At about 3pm, before the signup sheet is circulated; make sure that you sign up before leaving. Submit your labs work via portal (M on W at 11:59pm, W on F at 11:59pm).
The further you get today, the better shape your will be in for your upcoming first graded homework assignment.
For the portal submissions, please minimally mark your code files with a comment on top:
// firstname lastname
While the portal provides information that will allow me to link your submission to your name, your explicit names on your work will make the recording of earned credit more robust.
***
Place the code on the following pages into a file named
Vector.h
(copy code until you reach the last page).
Reviews
There are no reviews yet.