1 |
h07 |
CS24 W18 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h07: Chapter 6, sections 6.1-6.6
ready? | assigned | due | points |
---|---|---|---|
true | Tue 05/15 11:00AM | Tue 05/22 11:00AM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)
Please:
- No Staples.
- No Paperclips.
- No folded down corners.
Complete your reading of Chapter 6, section 6.1 -6.2, 6.3 (ignore references to multiset of page 139), 6.4-6.6 (If you don’t have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”).
-
1. (10 pts) Write a template function named IsEqual() that compares two items and returns a boolean. If the items are equal the function should return true otherwise it should return false. The function has two parameters of the same type. The type may be any type that has a copy constructor and the == operator defined.
2. (10 pts) Re-read pages 314-315. Then consider the Sequence class provided in this file . The Sequence class currently stores a list of words in a static array. Convert this class to a template class that can be used to store a collection of any datatype instead of just std::string. Write the new definition of the Sequence class below. You don't have to implement the methods.