Welcome to Professor Ziegler's CISC 1110 Sample Program Home Page




The following are links to files containing source code foir the sample programs used during the in-class lectures. You may download a copy of these notes only if you are a registered student in my CISC 1110 class. To download a file, RIGHT CLICK on the link and use the "Save Link Target As" feature of your browser.

Chapter 1:

Introductory Program - Welcome

Program to illustrate keyboard input and monitor output

Program to illustarte addition

Introductory Sample Program

Program to illustrate iteration

Program to illustrate use of for loops


Chapter 2:

Writing an Expression

Using Table Headings

Using Tabs

Redirecting cout to a file

Using a separate output file object

Using a separate output file object - illustrating .open()

Redirecting cout to a file - illustratimg .open()


Chapter 3:

Payroll program

Setting decimal precision

Setting output width

Left Alignment

Setting precision and width

Illustration if-else statement

Payroll program redirection of cout to a file

Payroll program with separate output file object

Payroll program redirection of both cin and cout to files

Payroll program with separate input and output file objects

Payroll program with tabular output

Sample input data file for Chapter 3 programs


Chapter 4:

Sum of Squares example

Loop Control Variables

Defining a Constatnt

Reading in a value for loop termination control

Multiplication Table - Nested for loops


Chapter 5:

Simple Program with a Function

Multiplication Table using functions

Pass by Value Example

Reference Variables - Pass by Reference Example

Functions that return multiple values

Multiplication Table using functions with file I/O


Chapter 6:

Classify program

Nested if-else statements

Shortcut - Direct calculation of which week

Variables of type bool

Returning a value of type bool


Chapter 7:

Calculating the Average of an Exam

Using Arrays

Calculating the Average of an Exam - more modular version

Passing an array to a function

Exam Statistics

Exam Statistics - using .eof()

Exam Statistics - detecting EOF

Exam Statistics - detecting EOF - separate input file object

Two Dimensional Arrays

Sample input data file for Chapter 7 programs

Sample input data file for Two Dimesional Array program


Chapter 8:

Illustrating String .find()

Illustrating .replace(), .erase(), and .insert()

Passing a String to a function

Using Global File References

Redirecting cin and cout to files

Less modular version

Less modular version - function change() using .replace()

Less modular version - Global File Reference for changes file

Less modular version - Global File Reference for changes file - function change() using .replace()

More modular version - Passing a File Reference to a function

More modular version - Global File Reference for changes file

Array of Strings

Passing an array of strings to a function

Sample input data file for Chapter 8 programs

Sample "changes" input data file for Chapter 8 programs


Chapter 9:

Linear Sort and Binary Search

Bubble Sort and Binary Search

Soring Strings

Sorting strings in a function


Chapter 10:

Using struct

Using struct - alternate implementation

Using class

Using class - alternate implementation

Using class - This code will not compile

Using class - This code will not compile - alternate implementation

Using only class

Using only class - alternate implementation

Using only class - This code will not compile

Using only class - This code will not compile - alternate implementation

Member Functions using struct

Member Functions using class

Member Functions using only class

Member Functions using only class - This code will not compile

Sample input data file for Chapter 10 programs


Comments or suggestions should be sent to:

ziegler@sci.brooklyn.cuny.edu

Chaim Ziegler, Ph.D.
Brooklyn College
Department of Computer and Information Science
2900 Bedford Avenue
Brooklyn, NY 11210
(718) 951-5000 x2074