Demonstration programs for my EECS 138 (Intro to C++) lectures.
The programs are organized according to the chapters in Problem Solving with C++ (9 ed) by Walter Savitch. Although most of the course contents are locked into blackboard, I want these sample programs to be available to anyone in the class even if they were in previous sections and no longer have access to blackboard.
Chapter 1 - Intro
Chapter 2 - Basics
Chapter 3 - Flow Control
Chapter 4 - Functions
- 4.1 - Simulating dice rolls
- 4.2 - Typecasting as a function call (int division vs double division)
- 4.3 - Check-if-even function
- 4.3 - Simple arithmetic functions
- 4.6 - Calculating the area of a pizza
- 4.x - Prime check function
- 4.x - Menu and Function calls
Chapter 5 - More on Functions
- 5.2 - Simple pass-by-reference demo
- 5.2 - Pass-by-reference value input
- 5.3 - Pass-by-reference swap & order
Chapter 6 - I/O Streams, files
- 6.1 - File outputing via function call
- 6.1 - Moving values from file to file
- 6.1 - File output, check if successfully opened
- 6.1 - Output dice rolls to file
- 6.1 - Extraction from file in while loop
- 6.x - File I/O functions
Chapter 7 - Arrays
- 7.1 - Opening files specified by the user
- 7.1 - Reading from file into array
- 7.1 - GPA calculation with records stored in array
- 7.1 - GPA calculation with function calls, array parameters
- 7.3 - Brute Force Search
- 7.3 - Binary Search
- 7.3 - Bubble Sort
Chapter 8 - Strings, Vectors
- 8.2 - Palindrome check
- 8.2 - String replacement
- [8.2,3 - Word Frequency Counter] (./8.2,3-WordFrequencyCount/)
- 8.3 - Store input in vector
- 8.3 - Simple vector operations
Chapter 9 - Pointers, Dynamic Arrays
- 9.1 - Pointer examples
- 9.1 - Pointer example: function parameter
- 9.2 - Dynamic array example
- 9.2 - Multi-dimensional dynamic array
- 9.2 - Multi-dim dynamic array - Computer Lab simulation (From Ch9 Programming Project 5)
Chapter 10 - Classes
- 10.1 - Struct example
- 10.1 - Struct for time data
- 10.2 - Bank account class v1
- 10.2 - Bank account class example v2
- 10.2 - TicTacToe class, 2D pointer array for board
- 10.2 - TicTacToe class, no pointers, 1D array
- 10.2 - Time class
- 10.3 - Queue for a Grocery Checkout Line
- 10.4 - Inheritance: student from person