return-multiple.rb:
A complete Ruby program illustrating returning multiple values from
a function.
echoinput.rb: echo standard input
to standard output (with line numbers); type
ruby echoinput.rb < echoinput.rb
at the command prompt (after installing Ruby) to display the program.
sum.rb: compute sum of entered
numbers. Enter
ruby sum.rb
5
4
3
Control-Z
(where the last line is holding down the control key and pressing a Z)
to print a 12.
generate.rb: generate a list of
numbers, one per line:
ruby generate.rb 20 30 3 | ruby sum.rb
98
gpa.rb: compute GPA
revised-gpa.rb: a version
of gpa.rb that can be loaded as a part
of a larger project
countvowels.rb: Ruby code to
count vowels in the input, illustrating breaking a program into multiple
functions with a main.
phones.rb: simple phone book based on
arrays; to test, run irb and type
irb> load 'phones.rb'
irb> test_phone_book
revised-phones.rb: revised
phone book using hash tables.
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.cpp
counts 17 semicolons, and
a.exe _ < occurrences.cpp
counts 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.
todo.cpp: simple todo list using
fixed-size arrays and strings.
ave.h,
ave.cpp,
printave.cpp: illustrating
separate compilation and reference parameters
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
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