CS 211 Spring 2007

Menu:

Syllabus

Homework 1
Solution to homework 1:
prime.cpp
perfect.cpp
leap.cpp
reverse.cpp

Homework 3

Sample Quiz 1:
Quiz A
Quiz B
Quiz C
Quiz D
Quiz E
Quiz F
Quiz H
Quiz I
Quiz J

Rat Class Example:
Rat.h
Rat.cpp
Rat_Main.cpp

Quiz 1
Solution:
Complex.h
Complex.cpp
main.cpp

Homework 4

Homework 5

Sample Exam 1:
Exam A
Exam B
Exam C
Exam D
Exam E

Homework 6
Homework 7

Project 1

Homework 8
Homework 9

Sample Exam 2:
Exam A
Exam B

SafeArray.h
SafeArray.cpp
MainSafeArray.cpp

Project2

demo of inheritance.cpp

Topics Chapters Code Samples
Administrativia, Review of material from previous semester, Data Types, Structures Savitch 1-6.1, 12  
Introduction to Classes, Classes and Functions, Public and Private Members, Structs vs. Classes Savitch 6.2 Students1.cpp
BankAccount.cpp
BankAccount2.cpp
BankAccount3.cpp
Constructors and Destructors, static functions and variables Savitch 7.1, 7.2

The following will be shown during lecture
main.cpp
Appear.h
Appear.cpp
ClassCounter.h
ClassCounter.cpp
StaticDemo.cpp

The following are not complete program examples:
main.cpp
BankAccount.h
BankAccount.cpp

The following were given as part of homework assignments previous semesters. They are intended as additional examples:
testDate.cpp
Date.h
Date.cpp
Guest.h
Guest.cpp
main.cpp

Inline function definitions, Constants, Constants as Parameters. Savitch 7.2 Student.h
Student.cpp
ConstDemo.cpp
Declare - Define - Use approach to writing classes, .h and .cpp files, Stages of Compilation, Macros and Preprocessor Directives, Separate Compilation of a program Savitch 11.1 Student.h
Student.cpp
main.cpp

Try preprocessing the following files, and see what happens:
g++ -E <fileName>
defineExample
file.cpp
ifdefExample.cpp
ifndefExample.cpp
includeExample.cpp
Pointers and References, Arrays and Pointers, Pointer Arithmetic Savitch 10.1 pointDemo.cpp
PointerAndReference.cpp
refPointer.cpp
arrayPointer.cpp
pointArith.cpp
Functions and Pointers, Constants and Pointers, Constants and References, Dynamic Allocation Savitch 10.2 funcPointer.cpp
Search.cpp
Doubler.cpp
DoublerB.cpp
DynamicDemo.cpp
Writeable Strings (by Dr. Vickery)
Two dimensional pointers, Introduction to Operator Overloading Savitch 8.1 TwoDArrayDemo.cpp
Fraction.h
Fraction.cpp
main.cpp
Overloading Operators within a class, Friend Functions, Overloading << and >> operators, Overloading ++, -- operators, Overloading [] operator Savitch 8.2, 8.3 Fraction.h
Fraction.cpp
main.cpp
Fraction.h
Fraction.cpp
main.cpp
CharPair.h
CharPair.cpp
main.cpp
IntPair.h
IntPair.cpp
main.cpp
Classes and Dynamic Allocation: putting it all together, Overloading = operator, Copy Constructors, Destructors, The -> operator, The this pointer Savitch 10.3 MyString.h
MyString.cpp
testMyString.cpp
DoubleList.h
DoubleList.cpp
Doubles.cpp
Test #1 Covers Lectures 1-10 N/A
Exception Handling, Throwing an Exception, Try-Catch Blocks Savitch 18 18-01.cpp
18-02.cpp
18-03.cpp
18-04.cpp
18-05.cpp
MyString.h
MyString.cpp
Introduction to Inheritance, Base Classes vs. Derived Classes, Protected, Redefining vs. Overloading, Constructors and Inheritance, Functions that are not inherited, Inheritance vs. Composition, The slicing problem Savitch 14.1 Number.h
Number.cpp
Fraction.h
Fraction.cpp
SquareRoot.h
SquareRoot.cpp
main.cpp
IllegalNumber.h
Pointers and inheritance, the slicing problem, casting, Polymorphism, late binding and virtual functions, pure virtual functions, abstract classes, bubble sort Savitch 14.2 Comparable.h
Integer.h
Integer.cpp
main.cpp
sort.cpp
Inheritance and Dynamic Allocation, Constructors, Copy Constructors, Destructors (always virtual), = overloads and Inheritance, Multiple Inheritance Savitch 15.1 Comparable.h
MyConstString.h
MyConstString.cpp
MyString.h
MyString.cpp
sort.cpp
testMyConstString.cpp
Moment.h
testMoment.cpp
Circle.h
Parallelogram.h
Rectangle.h
Rhombus.h
Shape.h
Square.h
shapeTest.cpp
Exceptions and Inheritance, Diamond Inheritance, Protected/Private Inheritance Savitch 15.2 DivideByZero.h
Exception.cpp
Exception.h
Fraction.cpp
Fraction.h
Number.cpp
Number.h
NumberFormatException.h
main1.cpp
main2.cpp
main3.cpp
Introduction to Templates, Function Templates, Class templates, Templates and Inheritance, Templates vs. Inheritance Savitch 16.1, 16.2 16-01.cpp
16-02.cpp
16-04.cpp
16-07.cpp
16-10.cpp
pfarray.cpp
pfarray.h
pfarraybak.cpp
pfarraybak.h
Introduction to Standard Template Library: vector and basic_string, Selection Sort, Linear Search, Binary Search Savitch 16.3, 7.3 07-07.cpp
sort.cpp
searchAndSort.cpp
searchAndSort.h
selectionSortIterative.cpp
testBinarySearch.cpp
testLinearSearch.cpp
linearSearchIterative.cpp
binarySearchIterative.cpp
Review and Overview of Recursion, void Recursion problems (eg. reversing an array), Mathematical Recursion, (Factorial, Fibonacci, Powers), Format of a Recursive function, Recursion vs. Iteration Savitch 13 13-01.cpp
13-02.cpp
13-03.cpp
fibonacciTrace.cpp
functionDemo.h
functionDemoIterative.cpp
functionDemoRecursive.cpp
testFactorial.cpp
testFibonacci.cpp
testPowerOfTwo.cpp
testReverse1.cpp
testReverse2.cpp
towersOfHanoi.cpp
Test 2    
Examples of Recursion, Searching and Sorting: Review of Linear and Binary Searches, Review of Bubble and Selection sorts, insertion sort (both iterative and recursive versions)
Towers Of Hanoi
Gaddis 8 13-06.cpp
13-08.cpp
binarySearchRecursive.cpp
bubbleSortIterative.cpp
bubbleSortRecursive.cpp
selectionSortRecursive.cpp
insertionSortIterative.cpp
insertionSortRecursive.cpp
linearSearchRecursive.cpp
testSelectionSort.cpp
Linked Lists: Nodes, Indexing an element, Insert, Remove Savitch 17.1 Exception.cpp
Exception.h
IndexOutOfBounds.h
LinkedList.cpp
LinkedList.h
Node.h
Linked Lists: Big 3, Search,
Conversion: Array to Linked List, Linked List to Array.
Savitch 17.1  
The Standard Template Library: Iterators, Containers Savitch 17.3, 19.1, 19.2 07-07.cpp
19-01.cpp
19-02.cpp
19-03.cpp
19-05.cpp
19-10.cpp
19-12.cpp
19-16.cpp
More examples from the STL: Stacks and Queues Savitch 17.2 Node.h
queue.cpp
queue.h
queue2.cpp
queue2.h
stack.cpp
stack.h
stack2.cpp
stack2.h
The Standard Template Library: Generic Algorithms, passing a function to another function as a parameter, void pointers. Savitch 19.3 functionPoint.cpp
templateSort.cpp
Final Exam