 |
Simple
Programs (Chapter 1)
|
 |
Examples
w/Fundamental Types (Chapter 2)
 |
constant.cpp
- Demonstrates literal
(constants) of each of the fundamental types
|
 |
size.cpp
- Demonstrates the size in bytes
of each of the fundamental types
|
|
 |
Examples
w/cin and cout (Chapter 2)
 |
swap.cpp
- Demonstrates cout
to
prompt for values from the user and cin
to read those values
into local variables |
|
 |
Examples
w/printf and scanf (from lecture)
 |
printf.cpp
- Demonstrates printf()
to print values to the terminal and to C-style string variables.
|
 |
scanf.cpp
- Demonstrates scanf()
to input variables from the keyboard and C-style strings.
|
 |
strchr.cpp
- Demonstrates strchr()
to find a given character in a C-style string. |
|
 |
Control
Flow: Selection (Chapters 2 and 3)
 |
boolean.cpp
- Demonstrates how to
declare and use boolean variables
|
 |
expr.cpp
- Demonstrates various types of
boolean expressions
|
 |
selection.cpp
- Demonstrates
single-, two-, and multi-alternative selection (if)
statements.
Also demonstrates the switch statement
|
 |
mathexpr.cpp
- Demonstrates a switch
statement
|
|
 |
Control
Flow: Looping (Chapters 2 and 3)
 |
average.cpp -
Demonstrates a while
loop and also totaling a running sum
|
 |
fact.cpp -
Demonstrates a while loop
|
 |
scope
- Demonstrate variable scope
|
 |
find_largest
- Demonstrate a for
loop
|
|
 |
Predefined
Functions (Chapter 4)
 |
screen_control
- Demonstrates
I/O manipulator setw() and the use of sleep() and control characters.
|
 |
outputbase.cpp
- Demonstrates the
I/O manipulators dec, oct, and hex
|
|
 |
Programmer-Defined
Function (Chapter 4)
 |
functions.cpp
- Demonstrates
function prototypes and simple function definitions
|
 |
debug.cpp
- Demonstrates how to use the
C++ preprocessor for conditional compilation
|
 |
area.cpp/a.cpp
- Demonstrates the before/after versions of a simple program with
functions
|
|
 |
Value and
Reference Parameters (Chapters 4 and 5)
|
 |
File and
Character I/O (Chapter 6)
|
 |
Introduction
to Classes (Chapter 10)
|
 |
Separate
Compilation (Chapter 10)
 |
See
examples in "Introduction to Classes"
|
|
 |
Arrays
(Chapter 7)
 |
letter_count
- Demonstrates a
nested loop, character arrays, and reading "white space"
|
 |
arrayinit.cpp
- Demonstrates the
various initialization possibilities with C++ arrays
|
 |
find_smallest
- Demonstrates a
search through an array for the smallest value
|
 |
insert
- Demonstrate how to insert an
array element in the middle of the array
|
 |
matrix_addition
- Demonstrates
how to declare and access multi-dimensional arrays
|
 |
flip_square
- Demonstrates how to access multi-dimensional arrays |
|
 |
Sorting
(Chapter 7)
 |
random_number
- Demonstrates
random number generation (for sorting) and file redirection examples
|
 |
insertion_sort.cpp
-
Demonstrates array access and manipulation with sorting as the example
|
 |
bubble_sort.cpp
- Demonstrates
"bubble sort" the easiest of the sorts to write (and also the
most inefficient)
|
 |
quick_sort.cpp
- Demonstrates how
much difference a good algorithm can make
|
|
 |
Strings and
Vectors (Chapter 8)
 |
str.cpp
- Demonstrates how to use getline
(a string input function)
|
 |
strex.cpp
- Demonstrates how to use each
of the string member functions: size(), substr() and find()
|
|
 |
Introduction
to Pointers (Chapter 9)
|
 |
Recursion
(Chapter 14)
|
 |
Random
Numbers (Appendix 4)
|
 |
Decryption
Example
 |
decrypt_test.cpp
- Demonstrates
how to use the decrypt() function for the homework on file I/O.
|
|