Winter 2005 CS 31 (Shinnerl)

Source-Code Examples

To access the files for an example, click on the icon near the left margin.

  1. Simple Introductory Examples
  2. GPA Calculation
  3. Namespaces
  4. Leap Years
  5. Dates, Weekdays, and Enumerations
  6. Printing Binary Digits
  7. Joining expressions with the comma (,) operator. Also illustrates the ?: operator.
  8. Integer division with negative arguments may not give a reliable answer!
  9. Formatted Output: printing out 2 digits after the decimal point.
  10. Function parameters: value and reference
  11. STL string operations
  12. Draw a customized jack-o-lantern.
  13. Arrays
  14. STL vector operations
  15. Recursion
  16. Sorting
  17. Basic File I/O and Semi-Robust Screen I/O
  18. File search. Search a collection of files for a given word.
  19. Classes; separate compilation. Includes Set and Calculator examples.
  20. Structs, Classes, Strings and File I/O. Course total example with C-style strings. Includes an STL-vector-based version.
  21. Randomized Simulation (coin toss), system time, sleep.
  22. Pointers, sorting, and functions used as arguments.

  23. Solving a single nonlinear equation by the method of bisection
  24. bisect.cpp Portable function for performing repeated bisection
  25. bdriver.cpp Driver, including definition of actual equation to solve.

  26. Return to CS 31 homepage