Week 06

Lecture slides (Vectors)

Lecture slides (Exceptions and String Stream)

Vectors

10.1-vector.cpp

10.2-moreVector.cpp

10.3-sieve.cpp

10.4-split.cpp

Note: minor correction; calling the vector constructor with one int argument (n) will create a vector of size n with each element default initialized (0 for numbers, empty for strings, etc.). So std::vector<int> vec(5); will result in a vector of 5 zeros.

Secondly, the capacity of a vector is only guarenteed to be equal or greater than the size. Its exact value (at constructor or later) is determined by the memory allocation used in a particular C++ implementation.

2D Vectors

10.5-2d.cpp

Range Based For Loops

Exceptions

11.1-assert.cpp

11.2-try-substr.cpp

11.3-stol.cpp

String Streams

11.5-sstream.cpp

11.6-istringstream.cpp

11.7-ostringstream.cpp