Don't forget to fill out the mid-quarter evaluation at! Your comments really make a difference!


Assignment 1 Out
November 17, 2009

Assignment 1 (Matrix) went out today and is due Friday, December 4 at 11:59 PM. This assignment will give you a chance to show off your C++ mojo while building a particularly cool piece of software. As always, if you have any questions, send me an email and I'd be glad to help out.

Good luck!

Problem Set 1 Due
November 12, 2009

Problem Set 1 is due tonight at 11:59PM, so be sure to submit your solutions by then. As always, if you have any questions, don't hesitate to send me an email!

Assignment 1 will be posted next Tuesday, so be sure to check back in then.

Assignment 0 Due, Problem Set 1 Out
November 5, 2009

Problem Set 1 went out today and is due on Thursday, November 12 at 11:59 PM (one week from today). It should help give you some practice using the C++ techniques we've covered over the last few weeks and hopefully will cement some of the more difficult concepts.

Assignment 0 is due tonight at 11:59PM. As always, feel free to email me if you have any questions; I'd be glad to help out!

Good luck!

stringstream bug in Snow Leopard
November 5, 2009

If you're a Mac user and you have the most recent version of Mac OS X (Snow Leopard), there's a chance that you'll run into a compiler bug when working with stringstreams. Apparently the default debug settings cause the class to behave incorrectly and if you want to use stringstreams you'll need to change your project configuration settings. See this link for information on how to fix this problem.

Thanks to John Ekins for pointing this out!

Assignment 0 Out, Problem Set 0 Due
October 22, 2009

Assignment 0 (Evil Hangman) went out today and is due on Thursday, November 5 at 11:59 PM. The dictionary file (based on the CS106 Lexicon) is available for download: here. Let me know if you come up with any interesting ideas while implementing the program!

Problem Set 0 is due tonight at 11:59PM. I will be in the LaIR tonight from 6pm - 8pm to answer questions, so feel free to drop on by.

The CS106L Midquarter Evaluation form is available at Please take the time to fill this out - your feedback will be taken seriously and is completely anonymous. If there's aspects of this course that you really like or would really like to see changed, this is your chance to let me know so that we can have an awesome second half of the quarter.

CityFinder Code Uploaded
October 16, 2009

The code from the CityFinder example from class has been uploaded to the lecture code section. I strongly encourage you to play around with this code - there's a wealth of information here just waiting to be harnessed. If you'd like the original US Census data files, check out

Problem Set 0 Out, Due October 22
October 13, 2009

Problem Set 0 went out today and is due Thursday, October 22 at 11:59PM. The problem set should be a great way to play around with the material we've covered so far and should help cement the major concepts we've explored. The problem set contains seven questions, of which you must complete five to receive credit.

As always, feel free to email me with any questions you might have. Good luck!

FreeCell Code Posted
October 8, 2009

The completed source code for the FreeCell lecture we covered in class on Thursday is now available online. Take some time to look over the code and play around with it... can you find any ways to make the code cleaner? Do you have any ideas on how to make the interface better? Any rules variants you want to implement? If you come up with anything interesting, send me an email and I'd love to look over anything you've written.

Have fun!

Welcome to CS106L! (no class Tuesday)
September 20, 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 260-113 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, September 22, so the first class will be Thursday, September 24.

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: Problem Set 0
02: Assignment 0
03: Problem Set 0 Solutions
04: Problem Set 1
05: Assignment 1
06: Problem Set 1 Solutions


Problem Set 0 (solutions)
  sample.cpp for Problem Set 0.
Problem Set 1 (solutions)

Assignment 0: Evil Hangman
  dictionary.txt for Hangman.
Assignment 1: Matrix
  Starter code


Errata to course reader
Spring 2009's CS106L Page
STL Prioritized Reference

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

Lecture Code

0.0: Prototypical "Hello, World!"
0.1: Basic cin usage.
0.2: Using getline.
0.3: stringstream examples.
1.0: GetInteger() implementation.
1.1: Integer removal.
1.2: Hexadecimal file viewer.
2.0: #define errors.
2.1: The X Macro Trick.
2.2: color.h for 2.1.
3.0: Basic STL stack.
3.1: Basic STL queue.
3.2: Stack time trial.
3.3: push_back time trial.
3.4: push_front time trial.
3.5: Element access time trial, pt. 1.
3.6: Element access time trial, pt. 2.
4.0: FreeCell
5.0: Basic STL set.
5.1: Basic STL map.
6.0: CityFinder.
7.0: Averaging numbers.
7.1: strutils.h functions.
7.2: Set algorithms.
8.0: Hearts.
9.0: C string examples.
10.0: DebugVector, version 0.
10.1: Copy and CopyIf.
11.0: DebugVector, version 1.
11.1: Initializer list time trial.
12.0: DebugVector, version 2.
13.0: DebugVector, version 3.
14.0: SharedPtr implementation.
14.1: Copy-on-write Lexicon.
15.0: Engines example.
16.0: count_if plus a functor.
16.1: Functor time trial.
16.2: Derivative functor.
16.3: bind2nd and ptr_fun.
17.0: Template metaprogramming [PDF].