CS 1320 (Principles of Algorithm Design I): 
	Sample Programs
(All programs/files referenced here are available on the CS lab
machines in directory /users/blm1320/SamplePrograms.)
 Programs from class 
-  (September 3) "Hello world" program.
	
 -  (September 3) Program to display internal representation of
	"int" with value -5.
	
 -  (September 8) Program to compute sum, average of two numbers,
	set in program.
	
 -  (September 8) Program to compute sum, average of two numbers,
	entered by user.
	
 -  (September 10) Program to compute
	sum, average of a sequence of numbers:
	
 -  (September 17) Program to make change:
	
 -  (September 20) Program to solve quadratic equations using
	quadratic formula:
	
 -  (September 24) Program to guess integer:
	
 -  (September 27) Program to compute variance:
	
 -  (September 29) A simple nested-loop example (multiplication
	table):
	
 -  (September 29) Program to simulate rolling a die and count
	how many rolls are required to see all faces, version 1
	(one trial):
	
	
 -  (October 4) Program to simulate rolling a die and count
	how many rolls are required to see all faces,
	version 2 (repeated trials):
	
 -  (October 8) Factorial function, together with a main program
	to test it / demonstrate its use.
	
	
 -  (October 8) "Combination" function, together with a main program
	to test it / demonstrate its use.
	
 -  (October 11) "Is it a palindrome?" function, with a main program
	to test it / demonstrate its use.
	
 -  (October 13) "Print name in frame" example, demonstrating 
	top-down design and functions.
	
 -  (October 22) File copying example.
	
 -  (October 27) Modified program from Quiz #5, showing 
	use of call by reference.
	
 -  (October 27) Simplified "paste" command.
	
 -  (October 29) Simplified "paste" command, modified to allow
		more than two input files.
	
 -  (November 8) Program to echo command-line arguments, one
	per line.
	
 -  (November 12) Program to demonstrate the "string" class.
	
 -  (November 15) Class for rational numbers.
	
	-  C++ source containing class definition and test program:
		
			rationals_v1_allin1.cc.
	
 -  C++ source separated into class definition, "class 
		implementation" (code for member functions, etc.),
		and test program:
		
	
 
 -  (November 17) Class for electronic checking accounts.
	
 -  (November 17) "Improved" class for rational numbers, showing
	use of operator overloading.  
	This example goes somewhat beyond the scope of this course,
	but is provided for those students who are curious about
	this particular bit of C++ magic.
	
	-  C++ source separated into class definition, "class 
		implementation" (code for member functions, etc.),
		and test program:
		
	
 
 -  (November 19) Recursion example:  factorial function.
	
 -  (November 19) Recursion example:  exponentiation function.
	
 -  (November 19) Recursion example:  function to count whitespace in
		a C string.
	
 -  (November 19) Recursion example:  function to compute sum of
		elements of an array.
	
 -  (November 19) Recursion example:  function to print file in
		line-by-line reverse order.
	
 -  (November 19) Recursion example:  function to compute Fibonacci
		numbers.
	
 -  (November 19) Optional recursion example:  function to compute numbers in
		Pascal's triangle.
	
 -  (November 22) Recursion example:  search for element in array of numbers.
	
 -  (November 22) Recursion/sorting example:  sort array of numbers.
	
 -  (December 6) Recursion/searching example:  binary search.
	
	(To compile this program, just compile the main program; the
	other parts will be included automatically.)
 
 Other programs 
Also see the Homeworks and other
assignments page for sample solutions to homeworks.
 Compilation tips 
See g++ Hints and Tips 
for tips about using the g++ compiler.