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

Announcements

Assignment 1 Results
March 11, 2008

Those of you who submitted Assignment 1 all did an excellent job! Everyone who submitted a solution to this assignment received credit and almost all of the solutions were completely flawless. Several of the SmartPointer implementations were very clever and many of you provided overloaded * and -> operators.

The most common error I encountered during testing was forgetting to deallocate the intermediary object after freeing a resource. This is a very important step, since smart pointers are designed to avoid memory leaks, but fortunately it's easily correctable with the addition of a single delete statement.

Stylistically, I noticed that many of you provided private member functions to the effect of getIntermediary that return the intermediary for the SmartPointer. Then, inside the copy constructor and assignment operator functions, to access the other SmartPointer's intermediary, the functions called other.getIntermediary(). This approach will work correctly, but because of sibiling access it is legal to directly access the private fields of another object of the same type inside of a member function. For example, inside the SmartPointer copy constructor, you can legally write intermediary = other.intermediary.

For those of you who overloaded the * and -> operators, you do not need to define a const-overloaded version of these functions. C++ treats const pointers and pointers-to-const objects differently, and if you have a pointer that itself is const, you can still modify the object it's pointing at (this is the reason the STL provides the const_iterator, since a const iterator and const_iterator are entirely different). Thus to overload these two operators, you should prototype them as T& operator *()const and T* operator ->() const.

Assignment 1 Due, 11:59 PM
March 10, 2008

Assignment 1 (SmartPointer) is due tonight at midnight, so please try to submit it by that time. I will be in the LaIR tonight from 10:00 - 12:00 tonight in case you have any questions.

Assignment 2 Out
March 5, 2008

Assignment 2: Where Am I? went out today and is due on Sunday, March 16 at 11:59 PM. It should be a great way for you to practice your functional programming constructs. For those of you who go on to take CS107, you might bump into this assignment again, except using Scheme or LISP instead of C++.

The starter files for Assignment 2 are available under the "Assignments" header on your right.

Test Code for SmartPointer Assignment
March 3, 2008

I've uploaded some test code for Assignment 1: SmartPointer that you can use to test your solutions with. It's by no means an exhaustive test, but it should smoke out some more insidious bugs. I will test your submissions by using this test code, plus some more intensive stress-tests, so it's completely to your advantage to play around with the code a bit.

Assignment 1 Out
February 27, 2008

Assignment 1: SmartPointer went out today and is due on Monday, March 10 at 11:59 PM. It should be a great way to practice your pointer skills, and when finished is an immensely useful programming tool. As always, feel free to email me any questions you might have.

Assignment 0 (Evil Hangman) has been graded and I've sent out emails containing my comments. Overall, you did an excellent job on the assignment, and I was impressed both by your clever implementation strategies and hilarious win/loss messages. If you have not received an email with feedback, please email me as soon as possible.

Assignment 0 Due Wednesday, 11:59 PM
February 20, 2008

Evil Hangman is due tonight (Wednesday, February 20th) at midnight, so be sure to submit it if you'd like to complete the assignment. I've received several emails about submission trouble, so if you're having difficulty submitting via FTP, just email me your .cpp file.

Thank you very much to those who have filled out the midquarter evaluation! It's really good to get feedback and I'll try to adjust the class according to your comments. If you haven't filled out the form, you can still do so at cs198.stanford.edu.

Midquarter Evaluation Forms Online
February 11, 2008

The CS106L Midquarter Evaluation form is available online at cs198.stanford.edu under the "Forms and Events" header. This is the second quarter we've ever offered this class and we want to hear how you think it's going. We will take your feedback seriously! It should only take you a few minutes to fill out the form, but it can really make a difference in how the rest of the quarter goes. All responses will be kept anonymous.

CityFinder Example Online
February 10, 2008

The CityFinder example from Wednesday's lecture is now available online. Feel free to play around with the code and experiment with iterators and algorithms. What sorts of questions can you answer based on the data file? If you come up with anything interesting, shoot me an email and I'd be glad to take a look at it.

Assignment 0 Out
February 6, 2008

Assignment 0 (Evil Hangman) just went out, and it's due in two weeks. The assignment should give you a great chance to practice your STL and IOStream skills. Plus, it's a great way to fool your friends!

As always, if you have any questions, feel free to email me with any questions about the assignment. Good luck!

No class on Wednesday, January 9
January 8, 2008

CS106X and CS106B are both meeting for the first time on Wednesday, January 9. To give everyone enough time to get some basic C++ syntax down before we jump headfirst into the standard libraries, CS106L will not meet on Wednesday, January 9. Our first class will be on Monday, January 14, at which point everyone should have a good familiarity with basic C++ syntax and we can start our exciting adventure into C++!

In the meantime, you might want to look over the course information handout, which has all sorts of administrivia and course placement information. Feel free to browse the handouts for our first lecture as well!

Welcome to CS106L!
January 7, 2008

Welcome to CS106L! We've got an exciting quarter ahead of us and you're in for a real programming treat. Classes meet Monday and Wednesday from 4:15 to 5:05 in Hewlett 103 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.

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!

Handouts

00: Course Information
01: C++ Standard Library
02: Writing Without Genlib.h
03: IOStream Library
04: C++ Strings
05: Intro to Pointers
06: C Strings
07: STL Containers, pt. 1
08: STL Iterators, pt. 1
09: STL Containers, pt. 2
10: STL Iterators, pt. 2
11: STL Algorithms
12: Assignment 0
13: Exception Handling
14: const
15: Initializer Lists
16: static
17: Copy ctor, operator =
18: Conversion Constructors
19: Assignment 1
20: Operator Overloading
21: Functors
22: STL <functional> Library
23: Assignment 2
24: Intro to Inheritance
25: Topics in Inheritance

Assignments

Assignment 0: Evil Hangman
dictionary.txt for Assn. 0
Assignment 1: SmartPointer
SmartPointer Test Code
Assignment 2: Where Am I?
WhereAmI.cpp starter file
WhereAmI.h starter file
main.cpp starter file

Resources

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

Lecture Code

0.0: Basic cin usage.
0.1: oct, dec, and hex.
0.2: Printing a table.
1.0: Integer removal.
1.1: simpio.h functions.
2.0: Basic STL stack.
2.1: Basic STL queue.
2.2: int stack time trial.
2.3: string stack time trial.
2.4: push_back time trial.
2.5: push_front time trial.
2.6: Element access time trial.
2.7: Cleanup time trial.
3.0: Basic STL set.
3.1: Basic STL map.
4.0: strutils.h implementation.
4.1: Set algorithms.
5.0: CityFinder example.
5.1: place-data.txt for 5.0.
6.0: Hearts simulation.
7.0: auto_ptr and linked lists.
8.0: const-correct Integer class I.
8.1: const-correct Integer class II.
8.2: Construction time trial.
9.0: Tracer class.
9.1: DebugVector, pt. 1.
10.0: DebugVector, pt. 2.
11.0: DebugVector, pt. 3.
12.0: count_if plus bind2nd.
12.1: Evil Hangman w/functors.
13.0: Scary Things example.
14.0: Engines example.