ave.cpp
: print the average of a list of
integers ave1000.cpp
: same, but
using arrays; build with g++ -std=c++11 ave1000.cpp
round_error.cpp
: illustrates why
==
on floats is a bad idea
simple_time.cpp
: illustrates
simple classes (along with cassert
)
occurrences.cpp
: count number of
times a character appears input. If build to a.exe, then
a.exe < occurrences.cppcounts 17 semicolons, and
a.exe _ < occurrences.cppcounts 5 underscores.
increasing-numbers.cpp
:
illustrates writing an eof-controlled loop with limits
increasing-numbers-v2.cpp
:
Same, but using functions.
distinct1000.cpp
: count number
of distinct values in the input.
countvowels.cpp
: count the
number of vowels; illustrating reading input by characters (and including
code to read from a file as well as standard input). This is the C++
version of countvowels.rb
.
ave.h
,
ave.cpp
,
printave.cpp
: illustrating
separate compilation and reference parameters
todo.cpp
: simple todo list using
fixed-size arrays and strings.
simple_vector.h
: Simple vector code
alg-examp.cpp
: illustrate
algorithm code
slist.cpp
: Simply Linked List
rwh_string.cpp
: simple
implementation of arbitrary-length strings
list_iterator.cpp
: illustrates
iterating over a list
repeated_words.cpp
:
illustrates using std::set
train.h
, train.cpp
:
a class hierarchy for trains; see
inheritance notes, especially
the class diagram; this
compiles to train.s
ave1000.cpp
, but this version prompts for inputs and computes
the average of doubles
array.c
: illustrates properties of arrays
points0.c
, points.c
:
structs in C using two different styles
messed_up.c
: really odd code...
hello.c
: yup
MysteryCode.java
Display.java
: illustrates
reading from standard input and writing to standard output
MysteryCode.java
:
illustrates that Java programs can be obfuscated as well
simp_asm_fun_call.cpp
:
Windows GAS code illustrating calling a function with embedded assembly
simp_mac_asm_fun_call.cpp
:
the Intel-based Mac version of the above embedded assembly
counting_bits.cpp
: assembly code to count the number of
bits set in the 2s-complement representation of an integer; the pure
assembly version (which assumes data is in %ebx) is
in counting_bits.asm
.