Michael Loceff's Modules
These modules were originally written by Michael. This is my snapshot from several quarters ago. Just like C++ itself, most of the material is still relevant and provided for easy reference here.
The most recent version of these modules could be found in many places online. I found a copy at our CS Club site, which may be about the same version as mine. These are for your benefit only. I only fix the odd serious typos.
Almost every topic we cover in CS2A can be found in Michael's material. Once you locate what you want, simply bookmark it in your browser. I left the Week numbers in the module headings intact. They are an approximate map to the sequence in which we cover topics in the course. But they are not exactly 1-1. So exercise your good judgement in deciding what to read when.
Happy Hacking,
&
Week 1A - The Programming Experience
Week 2A - Simple C++Programs
- Whitespace
- Program Statements
- Simple Numeric Statements
- Playing Computer
- Numeric Expressions and Operators
- A Console Example
Week 2B - Data Types
- Numeric Types
- Floating Point Types
- Character Types
- Type Compatibility
- Sample Programming Labs
- Typecasting Gotchas
Week 3A - User Input
- Introduction and Resources
- Strings
- String Concatenation
- User Input of Strings
- cin With Strings and Numbers
- String Conversions
- Formatting Numbers
- getline() for Strings and Numbers
Week 3B - Selection
- The IF Statement
- The IF/ELSE Statement
- The IF/ELSE/IF Block
- Switch and Case
- Relational Expressions
- Logical Operators
- A Sample Program Analysis
Week 4A - Repetition
- Introduction and Resources
- Loops
- A Closer Look at FOR Loops
- A Closer Look at WHILE Loops
- Ex(c)iting Loops
- A Nice Example
Week 4B - Sneak Peek at Week 8A - Arrays and a Sort Algorithm
- Declaring Arrays
- An Array Example
- Arrays, Methods and Sorting
- Sorting String Arrays
- Remarks on Arrays
Week 5A - Methods
- Introduction and Resources
- Methods (Functions)
- Defining Methods
- The Mortgage Calculator
- Locals and Functional Return
- Mortgage Calculator Redux
Week 5B - Parameters Passing and Global Variables
- Globals
- Mortgage Calculator Version 3
- Parameters and Arguments
- Formal Parameters and Overloading
- Mortgage Calculator Take 4
Week 6A - Object-Oriented Programming (OOP)
- Introduction and Resources
- Classes You Define
- A Simple Class: Pet
- Classes Redefined
- The Employee Class
Week 6B - Instance Methods
- Methods Defined In Classes
- Understanding Constuctors
- Understanding Accessors
- Instance Members and Methods
- Essential Ideas in All Class Designs
Week 7A - Deeper into Classes
Week 7B - Interaction between Objects and Methods
- Reference Parameters
- Building on the Past
- Client View of the Class
- Designing the Class
- Yet Another Mortgage Calculator
Week 8A - Arrays and a Sort Algorithm (Deja vu)
- Declaring Arrays
- An Array Example
- Arrays, Methods and Sorting
- Sorting String Arrays
- Remarks on Arrays
Week 8B - Compound Data Types: Arrays in Classes
- A Student Class
- Anonymous Objects
- The Student Class, Completed
- Arrays Inside Classes
- A Character Counter Class
Week 9A - Search Algorithms and Stack Data Structures
Week 9B - Recursion and a Binary Search Algorithm
Week 10A - Pointers and Dynamic Memory
Week 10B - Older C Style Strings (Char Arrays)
- Defining CStrings
- CString Input and Output
- Moar CString Functions
- Comparing CStrings, S-C Strings and .NET Strings