Computer Science Using C++
Ch. 14 Exercises Remarks
This chapter covers "built-in" arrays in the first section and then a vector class is introduced. The vectro class used by the textbook author is found in vector.h. The AP curriculum uses a similar class called the AP vector class. Even though built-in arrays are useful the vector class is more efficient for several reasons although it does require more overhead (RAM, etc.) and slows program performance. The AP test does not require the use of built-in arrays, just the vector class.
Note that the null terminator is not necessary for general arrays. It is only used to end a character array.
Note that C++ built-in arrays begin with the index position of 0, unlike those in some versions of Basic which begin with an index of 1.
See the Vector Class Quick Reference on p. 283 at the end of Chapter 14 for a handy guide to using the vector class.
Exercise 14-1 (p. 273)
Save the source code as INTARRAY.CPP.
Exercise 14-2 (p. 275)
Find the file HIGHTEMP.CPP in the templates folder.
Answer the Section 14.1 Questions #1-5 on p. 275 at this time if you haven't already done so.
Exercise 14-3 (p. 277)
Find the files TEMPEX.H and USETEMP.CPP in the templates folder.
Exercise 14-4 (p. 278)
Find the file TEMPFUN.CPP in the templates folder.
Answer the Section 14.2 Questions #1-5 on pp. 278 & 279, at this time, if you haven't already done so.
Exercise 14-5 (p. 281)
Find the files VECTOR.H and VECTOREX.CPP in the template folder.
Answer the Section 14.3 Questions #1-5 on p. 252815, at this time, if you haven't already done so.
Return to Ch. 14 Resources Page
Computer Science Using C++ Home Page | CMPSC 101 Home Page