In Class Example Programs

Tuesday, July 31
Array of Structures (an array of programmer-defined struct student_record)
Structures (an example using programer-defined struct student_record)

Monday, July 30
Iteration versus Recursion (calculating n!)
Confusing Equality and Assignment (an assignment statement has a TRUE or FALSE "condition" depending upon the value being assigned)

Thursday, July 26
Passing an Entire Array (i.e. the memory address of the array) into a Programmer-Defined Function (example of CALL BY REFERENCE)
Passing an Element of an Array into a Programmer-Defined Function (example of CALL BY VALUE)
Using the Bubble Sort and the Binary Search Algorithms

Tuesday, July 24
Example of Storing a String in a Character Array
Initializing and Printing a Double-Subscripted Array (using for loops, one nested within the other)

Monday, July 23
Arrays & Using the Random Number Generator to Simulate Dice Throwing (2 6-Sided Dice versus 1 11-Sided Die)
Printing a Multiplication Table (using while loops, one nested within the other)
Using 2 Arrays (1 to store responses, the other to store the frequency of each response (from page 204 in the textbook)

Thursday, July 19
Examining the Ranges of Signed and Unsigned Integers

Tuesday, July 17
Simulating the Dice Game of Craps (from page 160 in textbook)
Example of the Random Number Generator
Finding the Maximum of 3 Integers with a User-Defined Function (example from page 150 in textbook with some notes on variable scope)
Using getchar Function to Read a String Terminated by the Newline Character (same example from page 111 in textbook with some changes)

Wednesday, July 11
Switch Statement based on the Value of a Character (Counting Letter Grades example from page 111 in textbook)
Switch Statement based on the Value of an Integer (Odd/Even Program)
ASCII Characters and Their Integer Equivalents

Tuesday, July 10
Repitition Using do/while Structure
Repitition Using for Statement

Monday, July 9
Dangling Else Problem (make sure you match the else clause with the appropriate if statement)
Preincrement, Postincrement and Arithmentic Operators

Thursday, July 5
Sentinel-Controlled While Loop (example from page 72 in textbook)
Counter-Controlled While Loop (example from page 68 in textbook)

Tuesday, July 3
if Selection Structure with a Compound Statement
if Selection Structure Nested within an if Statement
if/else Selection Structure with Compound Statements
Coins Program (if/else Selection Structure with Compound Statements)

Monday, July 2
High-Low Program (reads in 5 grades using 1 scanf statement and determines the highest and lowest grade using if Selection Structures)

Thursday, June 28
Average Grade Program (reads in 3 grades using 3 scanf statements and calculates the average)
Even Odd Program (reads in 2 integers using 2 scanf statements and uses if Selection Structures to compare their values)
Even Odd Program #2 (same as above, except only 1 scanf statement is used to read in 2 integers)