BOOK_PROGRAMS
Textbook Programs for ISC_2012
BOOK_PROGRAMS contains
C programs that appear as examples in the textbook for ISC_2012,
"Programming in C", by Stephen Kochan.
Chapter 1: Introduction
-
(No program examples were given for this chapter.)
Chapter 2: Some Fundamentals
-
(No program examples were given for this chapter.)
Chapter 3: Compiling and Running Your First Programs
-
p3.1.c, Writing Your First C Program
-
p3.2.c, Printing More than One Line
-
p3.3.c, Displaying Multiple Lines of Output
-
p3.4.c, Displaying Variables
-
p3.5.c, Displaying Multiple Values
-
p3.6.c, Using Comments in a Program
Chapter 4: Variables, Data Types, and Arithmetic Expressions
-
p4.1.c, Using the Basic Data Types
-
p4.2.c, Using the Arithmetic Operators
-
p4.3.c, More Examples with Arithmetic Operators
-
p4.4.c, Illustrating the Modulus Operator
-
p4.5.c, Converting Between Integers and Floats
Chapter 5: Program Looping
-
p5.1.c, Calculating the Eighth Triangular Number
-
p5.2.c, Calculating the 200th Triangular Number
-
p5.3.c, Generating a Table of Triangular Numbers
-
p5.3a.c, Generating a Table of Triangular Numbers (revised)
-
p5.4.c, Asking the User for Input
-
p5.5.c, Using Nested FOR Loops
-
p5.6.c, Introducing the WHILE Statement
-
p5.7.c, Finding the Greatest Common Divisor
-
p5.8.c, Reversing the Digits of a Number
-
p5.9.c, A Revised Program to Reverse the Digits of a Number
Chapter 6: Making Decisions
-
p6.1.c, Calculating the Absolute Value of an Integer
-
p6.2.c, Calculating the Average of a Set of Grades
-
p6.3.c, Determining if a Number is Even or Odd
-
p6.4.c, Revised Program to Determine if a Number is Even or Odd
-
p6.5.c, Determining if a Year is a Leap Year
-
p6.6.c, Implementing the SIGN Function
-
p6.7.c, Categorizing a Single Character
-
p6.8.c, Evaluating simple expressions, using if/elseif/else.
-
p6.8a.c, Revised program to evaluate a simple expression, checking for zero divisors.
-
p6.9.c, Revised program to evaluate a simple expression, using "switch"
-
p6.10.c, Generating a table of prime numbers.
-
p6.10a.c, Revised program to generate a table of prime numbers,
using a boolean variable.
Chapter 7: Working with Arrays
-
p7.1.c, Working with an Array
-
p7.2.c, Demonstrating an Array of Counters
-
p7.3.c, Generating Fibonacci Numbers
-
p7.4.c, Revised Program to Generate Prime Numbers
-
p7.5.c, Initializing Arrays
-
p7.6.c, Introducting Character Arrays
-
p7.7.c, Converting a Positive Integer to Another Base
-
p7.8.c, Generating Fibonacci Numbers Using Variable-Length Arrays
Chapter 8: Working with Functions
-
p8.1.c, Writing a function in C
-
p8.2.c, Calling functions
-
p8.3.c, More on calling functions
-
p8.4.c, Calculating the n-th triangular number
-
p8.5.c, Revised program to find the greatest common divisor
-
p8.6.c, Finding the greatest common divisor and returning the results
-
p8.7.c, Calculating the absolute value
-
p8.8.c, Calculating the square root of a number
-
p8.9.c, Finding the minimum value in an array
-
p8.10.c, Revised function to find the minimum value in an array
-
p8.11.c, Changing array elements in functions
-
p8.12.c, Sorting an array of integers into ascending order
-
p8.13.c, Using multidimensional arrays and functions
-
p8.13a.c, Multidimensional variable-length arrays
-
p8.14.c, Converting a positive integer to another base
-
p8.15.c, Illustrating static and automatic variables
-
p8.16.c, Calculating factorials recursively
Chapter 9: Working with Structures
-
p9.1.c, Illustrating a structure
-
p9.2.c, Determining tomorrow's date
-
p9.3.c, Revised program to determine tomorrow's date
-
p9.4.c, More revised program to determine tomorrow's date
-
p9.5.c, Updating the time by one second
-
p9.6.c, Illustrating arrays of structures
-
p9.7.c, Illustrating structures and arrays
Chapter 10: Character Strings
-
p10.1.c, Concatenating character arrays
-
p10.2.c, Counting the characters in a string
-
p10.3.c, Concatenating character strings
-
p10.4.c, Testing strings for equality
-
p10.5.c, Reading strings with scanf()
-
p10.6.c, Reading lines of data
-
p10.7.c, Counting words
-
p10.8.c, Counting words in a piece of text
-
p10.9.c, Using the dictionary lookup program
-
p10.10.c, Modifying the dictionary lookup program using binary search
Chapter 11: Pointers
-
p11.1.c, Illustrating pointers
-
p11.2.c, More pointer basics
-
p11.3.c, Using pointers in expressions
-
p11.4.c, Using pointers to structures
-
p11.5.c, Using structures containing pointers
-
p11.6.c, Using linked lists
-
p11.7.c, Traversing a linked list
-
p11.8.c, Using pointers and functions
-
p11.9.c, Using pointers to exchange values
-
p11.10.c, Returning a pointer from a function
-
p11.11.c, Working with pointers to arrays
-
p11.12.c, Summing the elements of an array
-
p11.13.c, Pointer version of copyString()
-
p11.14.c, Revised version of copyString()
-
p11.15.c, Using pointers to find the length of a string
Chapter 12: Operations on Bits
-
p12.1.c, The bitwise AND operator
-
p12.2.c, Illustrate bitwise operators
-
p12.3.c, Implementing a shift function
-
p12.4.c, Implementing a rotate function
Chapter 13: The Preprocessor
-
p13.1.c, Introducing the #define statement
-
p13.2.c, More on working with #define
-
p13.3.c, Using the #include statement
Chapter 14: More on Data Types
-
p14.1.c, Using enumerated data types
Chapter 15: Working with Larger Programs
-
(No program examples were given for this chapter.)
Chapter 16: Input and Output Operations in C
-
p16.1.c, Illustrating the printf() formats
-
p16.2.c, Copying characters from standard input to standard output
-
p16.3.c, Copying files
Chapter 17: Miscellaneous and Advanced Features
-
p17.1.c, File copy program using command-line arguments
Chapter 18: Debugging Programs
-
p18.1.c, Adding debug statements with the preprocessor
-
p18.2.c, Compiling in debug code
-
p18.3.c, Defining a DEBUG macro
-
p18.4.c, A simple program for use with gdb
-
p18.5.c, Working with gdb
Chapter 19: Object-Oriented Programming
-
p19.1.c, Working with fractions in C
-
p19.3.cpp, Defining a C++ class to work with fractions
(you need a C++ compiler, such as g++, to use this example.)
Last revised on 31 May 2012.