Winter 2004 CS 31 (Shinnerl)

Source-Code Examples

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

  1. GPA Calculation
  2. Namespaces
  3. Leap Years
  4. Dates, Weekdays, and Enumerations
  5. Printing Binary Digits
  6. Joining expressions with the comma (,) operator. Also illustrates the ?: operator.
  7. Integer division with negative arguments may not give a reliable answer!
  8. Formatted Output: printing out 2 digits after the decimal point.
  9. Function parameters: value and reference
  10. STL string operations
  11. Draw a customized jack-o-lantern.
  12. Arrays
  13. STL vector operations
  14. Recursion
  15. Sorting
  16. Basic File I/O and Semi-Robust Screen I/O
  17. Classes; separate compilation. Includes Set and Calculator examples.
  18. Wang examples: more classes. Includes Fraction example.
  19. Wang examples: polynomials.
  20. Structs, Classes, Strings and File I/O. Course total example with C-style strings. Includes an STL 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