This page documents what we do in class. It contains C++ programs (and occasional C or Java programs) that we will discuss in class, simple homework exercises that you can work on for practice and exam preparation (not for credit), and reading assignments from our textbook.
The reading assignments and practice problems are listed by the date on which they were assigned. The sample program files are listed by the date on which they were used. You can click on any .cpp , .h , .c , or .java link and see the source code. When you are viewing source code, you can use your browser's "File -> Save As..." menu item to save a copy of the file on your computer. It is a good idea for you to "play" with these example programs; compile them, run them, make simple changes to them and compile and run them again.
- Wednesday, April 28.
- Remember that the final exam is on Monday, May 3, from 1:00-3:00.
- Here is a fairly good explanation of polymorphism from a web site of C/C++ tutorials.
- Here is an article, from a well know Java website, about using exceptions.
- Here are some Java programs that demonstrate exceptions.
- Monday, April 26.
- For Wednesday, read Chapter 17 (pages 924-952).
- Wednesday, April 21.
- Here is a simple demonstration of polymorphism.
- Here are two programs that demonstrate a bit about pointers. The first one uses pointers to explain how C++ handles two dimensional arrays.
- For Monday, read Section 16.3 (pages 896-911).
- Monday, April 19.
- Your tenth (and last) homework assignment is available from the homework page
- For Wednesday, read Sections 16.1 and 16.2 (pages 866-894).
- Monday, April 12.
- Your ninth homework assignment is available from the homework page
- Here is a link to a brief movie, made at Stanford University, about pointers.
- And here is a link to some more information, from Stanford University, about pointers.
- Read Section 12.1 (pages 698-711).
- For Wednesday, read Section 12.2 (pages 712-722).
- Wednesday, March 31.
- Here is a link to a reference for all of the Standard C library functions, including the C string functions used in C++ (and also the C math functions used in C++).
- For Monday, read Section 11.2 (pages 664-683).
- Monday, March 22.
- The second midterm exam will be Wednesday, April 7 (next week). The exam wil cover Chapter 7 (particularly boolean expressions and block scope), Chapter 8, Chapter 9, Chapter 10, and Sections 11.1, 11.2.
- Your eighth homework assignment is available from the homework page
- For Wednesday, read Section 11.1 (pages 644-664).
- Here are three simple programs that demonstrate a bit about arrays.
- Wednesday, March 24.
- Read Sections 10.4 and 10.5.
- Monday, March 22.
- Your seventh homework assignment is available from the homework page
- For Wednesday, read Section 10.3.
- Wednesday, March 10.
- In order to do "separate compilations" with Textpad and GCC, we need to define two new Textpad tools. Here is a page that describes how to create these two new tools.
- For Chapter 6 we did an example of a
Hat class in C++ with two different implementations of the same interface. Here is that example once again, but with the "interface" and the "implementation" of the Hat class in separate files, and the "application" of the Hat class in a third file.
- Here is the same example, two implementations of a
Hat class, written in Java. This Java version is a bit cleaner that the C++ version.
- Read Section 9.2, pages 535-553.
- Read Sections 10.1 and 10.2, pages 558-592. These sections are on arrays and most of this material is very similar to Java.
- Monday, March 8.
- For Wednesday, read Section 9.1, pages 518-535.
- Here is a short program that demonstrate a subtle aspect of defining friend functions. Taken from an article in "C/C++ Users Journal".
- Wednesday, March 3.
- An example, translated into three different languages, that shows how each language handles the concept of block scope in a different way.
- Monday, March 1.
- Your sixth homework assignment is available from the homework page
- Read Section 8.2, pages 486-505.
- A simple example using the
bool data type.
- A simple example of an
enum data type.
- Wednesday, February 25.
- For next week, read Section 8.1, pages 460-485.
- Monday, February 23.
- Read Chapter 7. Most of what is in this chapter is the same as from Java. The main difference is that C++ evaluates boolean expression a bit differently (see in particular pages 387-388). Be sure to read the page about "enumeration types", page 391, and also the pages about blocks and scope, pages 410-413.
- Wednesday, February 18.
- Remember that the first midterm exam is on Monday.
- Here is another example of using "information hiding".
- Here is the same example of "information hiding" written in Java. This Java version is a bit cleaner that the C++ version.
- Monday, February 16.
- Your fifth homework assignment is available from the homework page
- Here is a simple example of using "information hiding" in a class, that is, separating the public interface of the class from its private implementation.
- Read Section 6.3, pages 358-368.
- Wednesday, February 11.
- Some examples of defining a class and using objects from the class.
- Read Section 6.2, pages 321-357.
- Monday, February 9.
- NOTE: We shall postpone the first midterm exam by one week to Monday, February 23. This will give us time to finish Chapter 6 before the exam.
- Your fourth homework assignment is available from the homework page
- Here is a program that demonstrates ideas from Section 5.4 of the textbook.
- Some examples demonstrating ideas from Section 6.1.
- Wednesday, February 4.
- These files demonstrate some more I/O ideas.
- When working with character I/O, as some of these example programs do, it is sometimes useful to look up characters in an ASCII table. There is an ASCII table on page 958 of our textbook, but it is not complete. Here is a link to an online ASCII table that has all 256 of the (extended) ASCII character codes, including the non-printable "control codes" (i.e., the codes below 32).
- Here are two little programs that print out all of the ASCII characters. Compare the output with the above ASCII chart. The second version is a small puzzle to think about.
- Read Sections 5.3 and 5.4, pages 262-289.
- Read Section 6.1, pages 308-321.
- Monday, February 2.
- Your third homework assignment is available from the homework page
- Here are three files that demonstrate some I/O ideas that are not in the textbook.
- Read Section 5.2, pages 247-261.
- Wednesday, January 28.
- Here are a few more examples of using (or misusing) call-by-reference.
- Here are four different solutions to the first homework assignment.
- Read Chapter 4, Sections 4.3 and 4.4, pages 198-214.
- Read Section 5.1, pages 226-246.
- Monday, January 26.
- Your second homework assignment is available from the homework page
- In Chapter 3, notice pages 117-119 about casting. The notation for casting in C++ is different from the notation used in Java.
- Here is an example of using a formal parameter as a local variable, and an example of overloading a function.
- Here is an example of a function that uses call-by-reference.
- Read Chapter 4, Sections 4.1 and 4.2, pages 176-197.
- Wednesday, January 21.
- Your second homework assignment will available from the homework page by Friday. Please check for it then.
- Here is a simple program that demonstrates call-by-value parameter passing and another program that demonstrates the idea of procedure abstraction.
- Read Chapter 3, pages 110-166.
- Wednesday, January 14.
- Your first homework assignment is available from the homework page.
- An example program using some basic data types.
- Here are three versions of a simple C++ program that uses a user defined function.
- Monday, January 12.
- For the first week, read Chapters 1 (pages 2-34) and 2 (pages 40-98). Be sure to pay attention to the "Self-Test Exercises" that are scattered throughout the chapters (the answers to these problems are at the end of each chapter).
- Here is a template for writing simple C++ programs.
- You can use the following link to download a zip file of all of the source code examples from our textbook.
|
|