STL Containers Exercises

  < Previous  Next >
  1. What are the three (with C++11 four) types of STL containers? What are the container class templates for each type?
  2. Write a complete C++ program that:
    1. Reads in integers from STDIN (until a non-integer is entered) and stores them into a vector
    2. Print out how many numbers are in the vector (using a vector method if possible)
    3. Prints out the numbers in the container
  3. What would the equivalent program look like that used a traditional array?
  4. How does the vector (template) class determine how to allocate memory?

Last Modified: