Assignment 1 Due, Problem Set 4 Out.
May 28, 2009

Problem Set 4 went out today and is due on Friday, June 5 at 3:15PM. Remember that you only need to complete four of the five problem sets to get credit, so if you've successfully completed the first four problem sets you can skip this one without penalty.

Assignment 1 (Variant) is due tonight at 11:59PM. Feel free to email me with any comments or questions.

Good luck!

Handout #30.
May 25, 2009

This week we'll be exploring C++ inheritance, a remarkably versatile and powerful technique for designing collections of related classes. If you have taken CS106B or CS106X in a previous quarter, there is a chance that you might not have seen how inheritance works in C++ (particularly, the use of the virtual keyword or the = 0 syntax. If this is the case, you should try to read Handout #30 on inheritance before Tuesday's lecture, since we will be assuming it as background material. As always, if you have any questions on the material in this handout, send me an email and I'd be glad to clarify things.

Assignment 1 Out, Problem Set 3 Due.
May 21, 2009

Assignment 1 (Variant) went out today and is due on Thursday, May 28 at 11:59PM. The assignment will give you a chance to play around with a good number of C++ language features and the final product is relatively impressive. As always, feel free to email me if you have any comments or questions.

Problem Set 3 is due tonight at 11:59PM, so please try to have it submitted by then.

Good luck!

Assignment 0 Due, Problem Set 3 Out.
May 14, 2009

Problem Set 3 went out today and is due on Thursday, May 21 at 11:59PM. This is the first problem set that focuses primarily on C++-specific language features and should be a great way to experiment with the language features we've been exploring this week.

Assignment 0 is due tonight at 11:59PM, so please try to have it submitted by then. I will be available in the LaIR tonight from 8PM to 10PM, so if you have any questions feel free to drop on by.

Good luck!

Assignment 0 Out, Problem Set 2 Due.
April 30, 2009

Assignment 0 (Evil Hangman) went out today and is due on Thursday, May 14 at 11:59PM. The assignment should be a great way for you to flex your newfound C++ muscles and I hope that you have fun with it. You have two weeks to work on the assignment, so hopefully it will be rather low-stress. You will need the dictionary.txt file to use as a word list.

Problem Set 2 is due tonight at 11:59PM, so be sure to submit it before then.

Good luck!

CityFinder sample code online.
April 28, 2009

The sample code from the CityFinder example is now online, along with the place-data.txt data file. Feel free to experiment with the code, and feel free to email me if you come up with any interesting applications!

In case you're interested, the original US Census data file can be found at

Thanks to William Ito for pointing out that there are indeed two cities in the US that have the same name and state (Springfield, NJ and Springfield Township, NJ). If you want to play around with the code a bit, see if you can change the map<string, cityT> of all of the cities into a multimap.

Problem Set 1 Due, Problem Set 2 Out
April 23, 2009

Problem Set 2 is now available and is due on Thursday, April 30 at 11:59PM. The entire problem set is dedicated to STL containers and iterators and should help you get a solid feeling for how all the pieces fit together. Some of the problems on this set cover material that we did not have a chance to explore in class, so you'll probably want to have a reference handy when starting. The "Resources" section on this page has a few places you can look as a starting point.

Problem Set 1 is due tonight at 11:59PM, so try to have it submitted by then. Again, don't hesitate to email me questions. Also, if you haven't already done so, please sign up for a CS106L section so that we can grade your assignments.

Good luck!

Sign up for grading!
April 21, 2009

This is the first quarter that we've tried integrating the CS106L grading system in along with the system for the other CS106 classes and we're hitting a few technical difficulties. In order to ensure that your problem sets and assignments get graded, sign up for a CS106L section on the CS198 website. Note that these are not true sections, but instead are just a means for choosing your grader. After you've signed up, we can try to get your Problem Set 0 submissions graded and returned. Thanks!

Problem Set 0 Due, Problem Set 1 Out
April 16, 2009

Problem Set 1 is now available and is due on Thursday, April 23 at 11:59PM. I encourage you to review the handout on C strings, as well as the first and second handouts on the preprocessor before starting, since there are a few topics we didn't get a chance to cover in class.

Problem Set 0 is due tonight at 11:59PM, so try to have it submitted by then. Again, don't hesitate to email me questions.

Good luck!

Problem Set 0 Out
April 9, 2009

Problem Set 0 is now available and is due on Thursday, April 16 at 11:59PM. It should be a great way to play around with the material we've covered in class so far. As background, make sure that you've read the handout on pointers since there are a few topics on the problem set that we did not have time to cover in class today. As always, feel free to email me if you have any questions.

Room Change... again...
April 6, 2009

CS106L has moved again! We are now meeting in Econ 140. Class will still be at the same time as before (4:15 - 5:05, Tuesdays and Thursdays), so this change shouldn't affect anyone's schedules.

See you tomorrow!

Room Change
April 1, 2009

This information is outdated and has been removed

Welcome to CS106L!
March 30, 2009

Welcome to CS106L! We've got an exciting quarter ahead of us and you're in for a real programming treat. Classes meet Tuesday and Thursday from 4:15 to 5:05 in Econ 140 and I hope you're able to attend. I'll try to stick around afterwards for a little bit to answer questions so you can get the most out of the class. Class will not be meeting on Tuesday, March 31, so the first class will be Thursday, April 2.

This class is appropriate for almost anyone who wants to expand his or her knowledge of C++. If you have only a rudimentary background in C++, this class will quickly fill you in on some of the more advanced C++ concepts and syntax along with a solid understanding of the libraries. For those of you with many years of C++ experience, this class will almost certainly cover topics you haven't been exposed to - after all, C++ is an enormous language!


00: Course Information
01: C++ Standard Library
02: C++ Without genlib.h
03: C++ IOStream Library
04: Pointers and References
05: Problem Set 0
06: C Strings
07: Preprocessor Intro
08: Preprocessor Techniques
09: Problem Set 1
10: STL Containers 1
11: STL Iterators 1
12: STL Containers 2
13: Problem Set 0 Solutions
14: Problem Set 2
15: STL Iterators 2
16: STL Algorithms
17: Problem Set 1 Solutions
18: Assignment 0
19: const
20: Initializer Lists
21: static
22: Conversion Constructors
23: Copy Ctors, Assn. Opers.
24: Problem Set 2 Solutions
25: Problem Set 3
26: Operator Overloading
27: Functors
28: STL <functional> Library.
29: Assignment 1
30: Intro to Inheritance
31: Inheritance Topics
32: Problem Set 3 Solutions
33: Problem Set 4
34: C++0x


Problem Set 0 (solutions)
Problem Set 1 (solutions)
Problem Set 2 (solutions)
Problem Set 3 (solutions)
Problem Set 4

Assignment 0: Evil Hangman
dictionary.txt for Assn. 0
Assignment 1: Variant
Testing harness for Assn. 1


STL Prioritized Reference
C++ Resources Network
C/C++ Library Reference
Bjarne Stroustrup's C++ Page
CS106X page
CS106B page

Lecture Code

0.0: "Goodbye, world!"
0.1: Basic cin usage.
0.2: simpio.h functions, pt. 1.
1.0: Integer removal.
1.1: stringstream examples.
1.2: simpio.h functions, pt. 2.
2.0: Pointer examples.
3.0: C string examples.
4.0: #define errors.
4.1: The X Macro Trick.
4.2: color.h for 4.1.
5.0: Basic STL stack.
5.1: Basic STL queue.
5.2: Stack time trial 1.
5.3: Stack time trial 2.
5.4: push_back time trial.
5.5: push_front time trial.
5.6: Element access time trial 1.
5.7: Element access time trial 2.
6.0: Basic STL set.
6.1: Basic STL map.
7.0: CityFinder example.
7.1: place-data.txt for 7.0.
8.0: Averaging numbers.
8.1: Set algorithms.
8.2: strutils.h functions.
9.0: Hearts example.
10.0: Boost lambda and BOOST_FOREACH.*
10.1: set vs unordered_set time trial.*
10.2: lexical_cast demo.*
11.0: DebugVector, pt. 1
11.1: Initializer list time trial.
12.0: DebugVector, pt. 2
13.0: DebugVector, pt. 3
13.1: List iterators.
14.0: count_if plus a functor.
14.1: Functor time trial.
14.2: Derivative example.
14.3: C strings in an STL set
14.4: <functional> example.
15.0: Engines example.
16.0: C++ class implementation [PDF].
16.1: DimensionType example.
16.2: Operators example.
16.3: Uncopyable example.
17.0: Intro to C++0x [PDF].
17.1: Recommended Readings [PDF].
17.2: Template metaprogramming.

* Requires the Boost libraries.