Winter 2005 CS 31 (Shinnerl)
Source-Code Examples
To access the files for an example, click on the icon near the left margin.
Simple Introductory Examples
GPA Calculation
Namespaces
Leap Years
Dates, Weekdays, and Enumerations
Printing Binary Digits
Joining expressions with the comma (,) operator.
Also illustrates the ?: operator.
Integer division with negative arguments may not
give a reliable answer!
Formatted Output: printing out 2 digits after the decimal point.
Function parameters: value and reference
STL string operations
Draw a customized jack-o-lantern.
Arrays
STL vector operations
Recursion
Sorting
Basic File I/O and Semi-Robust Screen I/O
File search. Search a collection of files for a given word.
Classes; separate compilation.
Includes Set and Calculator examples.
Structs, Classes, Strings and File I/O.
Course total example with C-style strings.
Includes an STL-vector-based version.
Randomized Simulation (coin toss), system time, sleep.
Pointers, sorting, and functions used as arguments.
- Solving a single nonlinear equation by
the method of bisection
-
-
bisect.cpp
Portable function for performing repeated bisection
-
bdriver.cpp
Driver, including definition of actual equation to solve.
Return to CS 31 homepage