Get Programming Fundamentals A Modular Structured Approach Using C Kenneth Leroy Busbee Free All Chapters
Get Programming Fundamentals A Modular Structured Approach Using C Kenneth Leroy Busbee Free All Chapters
com
https://ebookname.com/product/programming-fundamentals-a-
modular-structured-approach-using-c-kenneth-leroy-busbee/
OR CLICK BUTTON
DOWLOAD NOW
https://ebookname.com/product/c-programming-a-modern-
approach-2nd-edition-k-n-king/
https://ebookname.com/product/research-methods-a-modular-
approach-2nd-edition-sherri-l-jackson/
https://ebookname.com/product/object-oriented-programming-using-
c-fourth-edition-joyce-farrell/
https://ebookname.com/product/programming-principles-and-
practice-using-c-1st-edition-bjarne-stroustrup/
Fundamentals of Structured Program Design 2nd Edition
Dan Robinson
https://ebookname.com/product/fundamentals-of-structured-program-
design-2nd-edition-dan-robinson/
https://ebookname.com/product/how-to-prove-it-a-structured-
approach-2nd-edition-daniel-j-velleman/
https://ebookname.com/product/programming-firefox-building-rich-
internet-applications-with-xul-1st-edition-kenneth-c-feldt/
https://ebookname.com/product/introducing-functional-programming-
using-c-leveraging-a-new-perspective-for-oop-developers-1st-
edition-vaskaran-sarcar/
https://ebookname.com/product/fundamentals-of-python-first-
programs-1st-edition-kenneth-a-lambert/
Programming Fundamentals - A Modular
Structured Approach using C++
By:
Kenneth Leroy Busbee
Programming Fundamentals - A Modular
Structured Approach using C++
By:
Kenneth Leroy Busbee
Online:
< http://cnx.org/content/col10621/1.22/ >
CONNEXIONS
8 8. Standard Libraries
8.1 Standard Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
8.2 Practice 8: Standard Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
22 22. Pointers
22.1 Address Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
22.2 Parameter Passing by Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
25 Review Materials
25.1 Review: Foundation Topics Group: 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
25.2 Review: Modular Programming Group: 6-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
25.3 Review: Structured Programming Group: 10-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
25.4 Review: Intermediate Topics Group: 17-21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
25.5 Review: Advanced Topics Group: 22-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
26 Appendix
26.1 Abbreviated Precedence Chart for C++ Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
26.2 C++ Reserved Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
26.3 ASCII Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
26.4 Show Hide File Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
26.5 Academic or Scholastic Dishonesty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
26.6 Successful Learning Skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
26.7 Study Habits that Build the Brain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Attributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Conceptual Approach
The learning modules of this textbook/collection were, for the most part, written without consideration of
a specic programming language. In many cases the C++ language is discussed as part of the explanation
of the concept. Often the examples used for C++ are exactly the same for the Java programming language.
However, some modules were written specically for the C++ programming language. This could not be
1
2
avoided as the C++ language is used in conjunction with this textbook/collection by the author in teaching
college courses.
Instructor Materials
Encrypted instructor materials are available in a module that is not part of this collection. It's title: Instruc-
tor Materials for: Programming Fundamentals - A Modular Structured Approach using C++ is available
at: http://cnx.org/content/m34529/latest/
2 and the encryption code is only available to educational insti-
tutional faculty that are considering adoption of this collection as a textbook.
About Connexions
Connexions Modular Content
The Connexions Project http://cnx.org
3 is part of the Open Educational Resources (OER) movement
dedicated to providing high quality learning materials free online, free in printable PDF format, and at
low cost in bound volumes through print-on-demand publishing. This textbook is one of many collections
available to Connexions users. Each collection is composed of a number of re-usable learning modules
written in the Connexions XML markup language. Each module may also be re-used (or 're-purposed') as
part of other collections and may be used outside of Connexions.
Read the book online, print the PDF, or buy a copy of the book.
To browse this textbook online, visit the collection home page. You will then have three options.
1. You may view the collection modules on-line by clicking on the "Start " link, which takes you to
the rst module in the collection. You can then navigate to the next module using "NEXT " and
2 "Instructor Materials for: Programming Fundamentals - A Modular Structured Approach using C++"
<http://cnx.org/content/m34529/latest/>
3 http://cnx.org/
4 http://creativecommons.org/licenses/by/2.0/
through the subsequent modules by using the " PREVIOUS | NEXT " button that is towards
the upper right to move forward and backward in the collection. You can jump to any module in the
collection by clicking on that module's title in the "TABLE OF CONTENTS" box on the left side of
the window. If these contents are hidden, make them visible by clicking on the small triangle to the
right of the "TABLE OF CONTENTS". Chapters also have a small triangle to show or hide contents.
2. You may obtain a PDF of the entire textbook to print or view oine by clicking on the "Download
PDF" link in the "Content Actions" box.
3. You may order a bound copy of the collection (for a reasonable printing and shipping fee) by clicking
on the "Order printed copy" button.
1. When it converts an "Example" the PDF displays the rst line of an example properly but indents
the remaining lines of the example. This problem occurs for the printing of a book (because it prints
a PDF) and downloading either a module or a textbook/collection as a PDF.
2. Chapter numbering has been added to the on-line Table of Contents. This will make it easier for
students to quickly get to the chapter reading materials. However this creates a "double" chapter
numbering within the textbook/collection's PDF and custom printing formats.
3. Within C++ there are three operators that do not convert properly to PDF format.
Table 1
I wish to acknowledge the many people who have helped me and have encouraged me in this project.
1. Mr. Abass Alamnehe, who is a fellow faculty member at Houston Community College. He has encour-
aged the use of Connexions as an "open source" publishing concept. His comments on several modules
have led directly to the improvement of the materials in this textbook/collection.
2. The hundreds (most likely a thousand plus) students that I have taken programming courses that I
have taught since 1984. The languages include: COBOL, main frame IBM assembly, Intel assembly,
Pascal, "C" and "C++". They have often suggested that I write my own book because they thought
that I was explaining the subject matter better than the author of the textbook that we were using.
Little did my students understand that directly or indirectly they aided in the improvement of the
materials from which I taught as well as improving me as a teacher.
3. To my future students and all those that will use this textbook/collection. They will provide suggestions
for improvement as well as being the thousand eyes identifying the hard to nd typos, etc.
4. My wife, Carol, who supports me in all that I do. She has tolerated the many hours that I have spent
in concentration on developing the modules that comprise this work. Without her support, this work
would not have happened.
5
6
Orientation
Textbook/Collection Layout
The approach of this course will be to take the student through a progression of materials that will allow
the student to develop the skills of programming. The basic unit of study is a Connexions module. Several
modules are collected into a chapter. The chapters are divided into ve groups.
Appendix N/A 7
Table 1
Some professors using this textbook/collection might decide to eliminate certain modules or chapters.
Some may eliminate the entire Advanced Topics group. Other professors may choose to add additional study
materials. The advantage of this textbook/collection is that it may be adapted by professors to suit the
needs of their students.
Chapter Layout
Each chapter will usually ow from:
As you proceed with the Connexions modules that comprise a chapter, you should:
7
8
• Do any exercises.
• Create 3x5 study cards for all denitions. When this material is used as a textbook for a course the
denitions are to be memorized. Conrm this with your professor.
• Learning Objectives
• Memory Building Activities aka MBAs Link These could consist of any of the following types of
interactive computer activities: ash card, crossword puzzle, seek a word, drag n drop, labeling,
ordering or sorting. When the materials are used as a textbook for a course, it is imperative that
students do a variety of repetitive activities in order to memorize basic course material. Besides, have
fun learning.
• Exercises In addition to any exercises within the study modules that you completed before the
practice module, there will be at least one exercise for students to complete.
• Miscellaneous Items These will exist for some of the chapters.
• Lab Assignment Usually, completed on one's own eorts. Review the instructions/restrictions from
your professor/teacher if using this for a high school or college credit course.
• Problems The intent of this activity is for students to formulate their own answers. Thus, solutions
to the problems will not be provided. When the materials are used as a textbook for a course, the
professor/teacher may assign students to a "Study Group" or let students form study groups to discuss
their solutions with each other. If you are using this for a high school or college credit course, verify that
you may work as team at solving the problems. This type of approved activity is called "authorized
collusion" and is not a violation of "Academic or Scholastic Dishonesty" rules.
A professor using this textbook/collection/course will most likely have additional lab assignments, quizzes
and exams that would be used in calculating your grade.
1. Starting Out with C++ Early Objects, by: Tony Gaddis et. al., 7
th Edition, International Edition,
ISBN: 978-0-13-137714-1
2. Starting Out with C++ Early Objects, by: Tony Gaddis et. al., 6
th Edition, ISBN: 0-321-51238-3
3. Starting Out with C++ Early Objects, by: Tony Gaddis et. al., 5
th Edition, ISBN: 0-321-38348-6
4. Computer Science A structured Approach using C++, by: Behrouz A. Forouzan et. al., 2
nd Edition,
ISBN: 0-534-37480-8
These textbooks are typically available in the used textbook market at a reasonable price. You may use
any one of the three books. If you acquire one of the above optional traditional textbooks, you may want
to download and store the following le to your storage device (disk drive or ash drive) in an appropriate
folder.
Download from Connexions: Connexions_Module_Reading_List_col10621.pdf
7
Syllabus
The syllabus for a course that is for credit will be provided by your specic course professor. If you are using
this textbook/collection for non-credit as self-study, we have some suggestions:
These is no magic way to learn about computer programming other than to immerse yourself into regular
study and study includes more than casual reading. To help you keep track of your study, we have
included a check o list for the textbook/collection.
Pre-Chapter Items 4
Chapters 1 to 5 27
Chapters 6 to 9 17
Chapters 10 to 16 30
Chapters 17 to 21 17
Chapters 22 to 24 11
Table 2
• Google's +1
• Facebook's Like
• twitter's Tweet
8 This content is available online at <http://cnx.org/content/m33960/1.2/>.
11
12
1. Introduction to Programming
13
14 CHAPTER 1. 1. INTRODUCTION TO PROGRAMMING
During the Design phase the System Analyst will document the inputs, processing and outputs of each
program within the application. During the Implementation phase programmers would be assigned to
write the specic programs using a programming language decided by the System Analyst. Once the system
of programs is tested the new application is installed for people to use. As time goes by, things change and a
specic part or program might need repair. During the Maintenance phase, it goes through a mini planning,
analysis, design and implementation. The programs that need modication are identied and programmers
change or repair those programs. After several years of use, the system usually becomes obsolete. At this
point a major revision of the application is done. Thus the cycle repeats itself.
1.1.2 Denitions
Denition 1.1: system analyst
Computer professional in charge of creating applications.
You need to get the software and a C++ source code program that has been tested and is error free.
two folders on your hard drive or
You will need about 80MB of storage space. We suggest that you create
ash drive depending on which installation you choose. If on a ash drive create them at the root level of
the drive. If on your home machine, you can use the folder area set up by the operating system for you as a
user. Name them:
2 This content is available online at <http://cnx.org/content/m18785/1.15/>.
• Compiler_Test
To help you keep les organized, you will want to create other sub-folders for storing source code les. We
suggest you create at least two other sub-folder to be used with Connexions' related modules. Within the
Cpp_Source_Code_Files, create sub-folders named:
• Demo_Programs
• Monitor_Header
The full version of the software is named: Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC
3.4.2 You can either download it from Bloodshed or download the version as of 12/8/2008 that is stored
on the Connexions web site. Store it in the Cpp_Software_Download folder you created. The software is
approximately 9.1 MB and will take several minutes to download if you are using a dial-up modem connection.
tip: The software has not signicantly changed since 2007 and the Connexions version will be
sucient for most users. The Bloodshed link requires some additional navigation to get to the
software download. Thus, because it is signicantly easier, we recommend that you download the
software from the Connections web site.
Listed below is a C++ source code le titled: Compiler_Test.cpp It has been prepared for Connexions web
delivery. Download and store it in the Compiler_Test sub-folder you created. You may need to right click
on the link and select "Save Target As" in order to download the le.
Download from Connexions: Compiler_Test.cpp
5
3 http://www.bloodshed.net/dev/devcpp.html
4 See the le at <http://cnx.org/content/m18785/latest/devcpp-4.9.9.2_setup.exe>
5 See the le at <http://cnx.org/content/m18785/latest/Compiler_Test.cpp>
1. Program Control - Functions used to simply sub divide and control the program. These functions are
unique to the program being written. Other programs may use similar functions maybe even functions
with the same name, but the content of the functions are almost always very dierent.
2. Specic Task - Functions designed to be used with several programs. These functions perform a
specic task and thus are useable in many dierent programs because the other programs also need
to do the specic task. Specic task functions are sometimes referred to as building blocks. Because
they are already coded and tested, we can use them with condence to more eciently write a large
program.
The main program must establish the existence of functions used in that program. Depending on the
programming language, there is a formal way to:
Program Control functions normally do not communicate information to each other but use a common area
for variable storage. Specic Task functions are constructed so that data can be communicated between
the calling program piece (which is usually another function) and the function being called. This ability to
communicate data is what allows us to build a specic task function that may be used in many programs.
The rules for how the data is communicated in and out of a function vary greatly by programming language,
but the concept is the same. The data items passed (or communicated) are called parameters. Thus the
wording: parameter passing. The four data communication options include:
//******************************************************
// Filename: Compiler_Test.cpp
6 This content is available online at <http://cnx.org/content/m18861/1.13/>.
#include <iostream>
using namespace std;
// Function Prototypes
void pause(void);
// Variables
int age1;
int age2;
double answer;
//******************************************************
// main
//******************************************************
int main(void)
{
// Input
cout "\nEnter the age of the first person --->: ";
cin age1;
cout "\nEnter the age of the second person -->: ";
cin age2;
// Process
answer = (age1 + age2) / 2.0;
// Output
cout "\nThe average of their ages is -------->: ";
cout answer;
pause();
return 0;
}
//******************************************************
// pause
//******************************************************
void pause(void)
{
//******************************************************
// End of Program
//******************************************************
This program has two functions, one from each of our categories. The technical layout of functions are the
same, it is our distinction that creates the two categories based on how a function is being implemented.
The main program piece in C++ program is a special function with the identier name of main. The
special or uniqueness of main as a function is that this is where the program starts executing code and this is
where it usually stops executing code. It is usually the rst function dened in a program and appears after
the area used for includes, other technical items, declaration of prototypes, the listing of global constants
and variables and any other items generally needed by the program. The code to dene the function main
is provided; however, it is not prototyped or usually called like other functions within a program. In this
simple example, there are no other program control functions.
We often have the need to perform a specic task that might be used in many programs. In the Com-
pile_Test.cpp source code above we have such a task that is used to stop the execution of the code until the
user hits the enter key. The functions name is: pause. This function is not communicating any information
between the calling function and itself, thus the use of the data type void.
<return value data type> function identifier name(<data type> <identifier name for input value>)
{
lines of code;
return <value>;
}
There is no semi-colon after the rst line. Semi-colons are used at the end of a statement in C++, but not
on the rst line when dening a function. Functions have a set of braces {} used for identifying a group or
block of statements or lines of code. There are normally several lines of code within a function. Lines of code
containing the instructions end in a semi-colon. Can you identify the denition of the pause function in the
above program example? The pause function denition is after the function main. Though not technically
required, most programs list all functions (program control or specic task) after the function main.
Let's identify the location where the function pause is called. The calling function is the function main
and it towards the end of the function. The line looks like:
pause();
When you call a function you use its identier name and a set of parentheses. You place any data items
you are passing inside the parentheses, and in our example there are none. A semi-colon ends the statement
or line of code. After our program is compiled and running, the lines of code in the function main are
executed and when it gets to the calling of the pause function, the control of the program moves to the pause
function and starts executing the lines of code in the pause function. When it's done with the lines of code,
it will return to the place in the program that called it (in our example the function main) and continue
with the code in that function.
Once we know how to dene a function and how to call a function, we usually will need to know how to
declare a function to the compiler (called a prototype). Because of normal computer programming industry
standards, programmers usually list the function main rst with other functions dened after it. Then
somewhere in the function main, we will call a function. When we convert our source code program to an
executable version for running on our computer, the rst step of the process is compiling. The compiler
program demands to know what the communication will be between two functions when a function is called.
It will know the communication (what going in and out as parameters) if the function being called has been
dened. But, we have not dened that function yet; it is dened after the function main. To solve this
problem, we show the compiler a prototype of what the function will look like (at least the communication
features of the function) when we dene it.
void pause(void);
This line of code looks exactly like the rst line in our function denition with one important addition
of a semi-colon. Prototypes (or declarations to the compiler of the communications of a function not yet
Summary concept: If you call
dened) are placed near the top of the program before the function main.
a function before it is dened you must prototype it before it is called. Looking at our list of the
three things you do in conjunction with a function in the order that they normally appear in a program,
there is a formal way to:
1. Documentation Most programs have a comment area at the start of the program with a variety
of comments pertinent to the program. Any line starting with two slashes // is a comment and the
compiler software disregards everything from the // to the end of the line.
2. #include<iostream> This line of code inserts a le into the source code. The le contains necessary
code to be able to do simple input and output.
3. using namespace std The C++ compiler has an area where it keeps the identier names used in a
program organized and it is called a namespace. There is a namespace created in conjunction with the
iostream le called: std. This line informs the compiler to use the namespace std where the identier
names in the iostream are established.
4. Function prototypes have already been explained.
5. We need some variables (storage areas) for this program to work. They are dened next.
1.3.4 Denitions
Denition 1.9: modularization
The ability to group some lines of code into a unit that can be included in our program.
1. Dene the terms on the denitions as listed in the modules associated with this chapter.
2. Install the Bloodshed Dev-C++ 5 compiler
3. Make minor modications to an existing program
1.4.3 Exercises
Exercise 1.4.1 (Solution on p. 26.)
Answer the following statements as either true or false:
1. Beginning programmers participate in all phases of the Systems Development Life Cycle.
2. The Bloodshed Dev-C++ 5 compiler/IDE is the preferred compiler for this text-
book/collection, however any C++ compiler will work.
3. Most compilers can be installed on a ash drive.
4. In addition to function as the name of a sub-program, the computer industry also uses macro,
procedure and module.
5. Generally functions fall into two categories: Program Control and Specic Task.
Within the Chapter 1 Connexions modules you were given directions on how to install the Bloodshed
Dev-C++ 5 compiler/IDE and to test your installation with the Compiler_Test.cpp source code le. If
you have not done this, return to the Connexions materials and complete this task.
In the compiler installation directions you were asked to make a folder named: Cpp_Source_Code_Files.
All of your lab assignments in this course assume you have that folder on the same drive as your compiler
(either drive C: your hard disk drive, or on a ash drive). If you don't have that folder, go create it now.
Depending on your compiler/IDE, you should decide where to download and store source code les for
processing. Prudence dictates that you create these folders as needed prior to downloading source code les.
A suggested sub-folder for the Bloodshed Dev-C++ 5 compiler/IDE might be named:
If you have not done so, please create the folder(s) and/or sub-folder(s) as appropriate.
Download and store the following le(s) to your storage device in the appropriate folder(s). You may need
to right click on the link and select "Save Target As" in order to download the le.
Download from Connexions: Compiler_Test.cpp
9
Read and follow the directions below carefully, and perform the steps in the order listed.
• Navigate to your sub-folder: Chapter_01 and rename the Compiler_Test.cpp source code le to:
Lab_01.cpp
• If you are having problems seeing the le extensions, visit the Show Hide File Extensions instructions
within the Appendix.
• Start your compiler and open the source code le. Carefully make the following modications:
note: During the rest of the course you will often use a source code le provided by the instructor
as your starting point for a new lab assignment. Sometimes you will use a source code le that
you have created as your starting point for a new lab assignment. Either way, you should modify
the comments area as appropriate to include at a minimum the four lines of information (lename,
purpose, author and date) as established in this lab assignment.
• We are now going to make simple modications to this program so that it is able to
average the weight of three people. Do the following:
• Within the variables area, change the variable names for age1 and age2 to weight1 and weight2. Add
another variable of integer data type with the identier name of weight3.
• The input area has two prompts and requests for data from the user. They are paired up a prompt
and getting data from the keyboard. We need to modify the prompt to ask for weight instead of age.
We need to change the variable name from age1 to weight1. Do this for the second pair that prompts
and gets the second data item. Create a third pair that prompts and gets the third data item.
• The process area has only one line of code and we need to make changes that add the weight3 and
divides by 3.0 instead of 2.0. The code should look like this:
• answer = (weight1 + weight2 + weight3) / 3.0;
• The output area needs the text modied from ages to weights.
• Build (compile and run) your program. You have successfully written this program if when it run and
you put in the three weights; it tells you the correct average.
• After you have successfully written this program, if you are taking this course for college credit, follow
the instructions from your professor/instructor for submitting it for grading.
1.4.6 Problems
1.4.6.1 Problem 01a Instructions
List the steps of the Systems Development Life Cycle and indicate which step you are likely to work in as a
new computer professional.
1. false
2. true
3. false
4. true
5. true
• Inputs
• Processing
• Outputs
This IPO approach works very well for beginning programmers. Sometimes, it might help to visualize the
programming running on the computer. You can imagine what the monitor will look like, what the user
must enter on the keyboard and what processing or manipulations will be done.
27
28 CHAPTER 2. 2. PROGRAM PLANNING & DESIGN
There are several methods or tools for planning the logic of a program. They include: owcharting,
hierarchy or structure charts, pseudocode, HIPO, Nassi-Schneiderman charts, Warnier-Orr diagrams, etc.
Programmers are expected to be able to understand and do owcharting and pseudocode. These methods of
developing the model of a program are usually taught in most computer courses. Several standards exist for
owcharting and pseudocode and most are very similar to each other. However, most companies have their
own documentation standards and styles. Programmers are expected to be able to quickly adapt to any
owcharting or pseudocode standards for the company at which they work. The others methods that are
less universal require some training which is generally provided by the employer that chooses to use them.
Later in your programming career, you will learn about using applications software that helps create an
information system and/or programs. This type of software is called Computer-aided Software Engineering.
Understanding the logic and planning the algorithm on paper before you start to code is very important
concept. Many students develop poor habits and skipping this step is one of them.
2.1.5 Denitions
Denition 2.1: IPO
Inputs - Processing - Outputs
2.2 Pseudocode2
2.2.1 Overview
Pseudocode is one method of designing or planning a program. Pseudo means false, thus pseudocode means
false code. A better translation would be the word fake or imitation. Pseudocode is fake (not the real thing).
It looks like (imitates) real code but it is NOT real code. It uses English statements to describe what a
program is to accomplish. It is fake because no complier exists that will translate the pseudocode to any
machine language. Pseudocode is used for documenting the program or module design (also known as the
algorithm).
The following outline of a simple program illustrates pseudocode. We want to be able to enter the ages
of two people and have the computer calculate their average age and display the answer.
Input
display a message asking the user to enter the first age
get the first age from the keyboard
display a message asking the user to enter the second age
get the second age from the keyboard
2 This content is available online at <http://cnx.org/content/m18648/1.10/>.
Processing
calculate the answer by adding the two ages together and dividing by two
Output
display the answer on the screen
pause so the user can see the answer
After developing the program design, we use the pseudocode to write code in a language (like Pascal, COBOL,
FORTRAN, "C", " C++", etc.) where you must follow the rules of the language (syntax) in order to code the
logic or algorithm presented in the pseudocode. Pseudocode usually does not include other items produced
during programming design such as identier lists for variables or test data.
There are other methods for planning and documenting the logic for a program. One method is HIPO. It
stands for Hierarchy plus Input Process Output and was developed by IBM in the 1960s. It involved using a
hierarchy (or structure) chart to show the relationship of the sub-routines (or functions) in a program. Each
sub-routine had an IPO piece. Since the above problem/task was simple, we did not need to use multiple
sub-routines, thus we did not produce a hierarchy chart. We did incorporate the IPO part of the concept
for the pseudocode outline.
2.2.2 Denitions
Denition 2.4: pseudo
Means false and includes the concepts of fake or imitation.
1. to check the model to see if it produces the correct results (model checking)
2. to check the coded program to see if it produces the correct results (code checking)
Test data is developed by using the algorithm of the program. This algorithm is usually documented during
the program design with either owcharting or pseudocode. Here is the pseudocode in outline form describing
the inputs, processing and outputs for a program used for painting rectangular buildings.
Example 2.2: Pseudocode using an IPO Outline for Painting a Rectangular Building
Input
display a message asking user for the length of the building
get the length from the keyboard
display a message asking user for the width of the building
get the width from the keyboard
display a message asking user for the height of the building
get the height from the keyboard
display a message asking user for the price per gallon of paint
get the price per gallon of paint from the keyboard
display a message asking user for the sq ft coverage of a gallon of paint
get the sq ft coverage of a gallon of paint from the keyboard
3 This content is available online at <http://cnx.org/content/m18781/1.4/>.
Resolving problems of this nature can be the most dicult problems a programmer encounters. You must
review each of the above to determine where the error is lies. Fix the error and re-test your program.
2.3.4 Denitions
Denition 2.5: model checking
Using test data to check the design model (usually done in pseudocode).
1. Dene the terms on the denitions as listed in the modules associated with this chapter.
2. Create a pseudocode document for a programming problem
3. Create a test data document for a programming problem
2.4.3 Exercises
Exercise 2.4.1 (Solution on p. 35.)
Answer the following statements as either true or false:
1. Coding the program in a language like C++ is the rst task of planning. You plan as you
code.
2. Pseudocode is the only commonly used planning tool.
3. Test data is developed for testing the program once it is code into a language like C++.
4. The word pseudo means false and includes the concepts of fake or imitation.
5. Many programmers pick up the bad habit of not completing the planning step before starting
to code the program.
Depending on your compiler/IDE, you should decide where to download and store source code les for
processing. Prudence dictates that you create these folders as needed prior to downloading source code les.
A suggested sub-folder for the Bloodshed Dev-C++ 5 compiler/IDE might be named:
If you have not done so, please create the folder(s) and/or sub-folder(s) as appropriate.
Download and store the following le(s) to your storage device in the appropriate folder(s). You may need
to right click on the link and select "Save Target As" in order to download the le.
Download from Connexions: Solution_Lab_01_Pseudocode.txt
6
Download from Connexions: Solution_Lab_01_Test_Data.txt
7
Read and follow the directions below carefully, and perform the steps in the order listed.
• Navigate to your sub-folder: Chapter_02 and print the: Solution_Lab_01_Pseudocode.txt and the:
Solution_Lab_01_Test_Data.txt les. Review the printouts in conjunction with your Lab 01 source
code le. Note: In Lab 01 we gave you step by step directions for modifying the Compiler_Test.cpp
source code le into the Lab_01.cpp source code le. I could have given you the pseudocode and
test data les, but you had not received any instructions about them. Now, after having studied the
Chapter 2 materials, these les should make sense.
• Make copies of the: Solution_Lab_01_Pseudocode.txt and Solution_Lab_01_Test_Data.txt and
rename them: Lab_02_Pseudocode.txt and Lab_02_Test_Data.txt
• Here is the problem. Your local bank has many customers who save their change and periodically bring
it in for deposit. The customers have sorted the coins (pennies, nickels, dimes and quarters forget
half dollars and dollar coins) and know how many (an integer data type) of each value they have but
have evolved (or their environment has made them lazy). They have lost their ability to do simple
arithmetic. They can't seem to determine the total value of all of the coins without a calculator (or
computer). Write a program to interact with the customers and to determine and report the total
value of their coins.
• No! No! No! We are not going to write a program (create source code) using the C++ programming
language. We are going to design a plan for a program using pseudocode as our model. Additionally,
we need to develop some test data for use in testing our model.
• Start your text editor (Microsoft Notepad. Set the font on Notepad to: Courier 12 font because Courier
uses the same amount of space horizontally for each letter. It will make the information in the les
show as it should be seen. Open your Lab 02 pseudocode text le. Change all items as needed to
be able to solve the above problem. NOTE: You may use any application software that will let you
open, modify and save ASCII text les. You may even use the Bloodshed Dev-C++ 5 compiler/IDE
software to view, modify and save ASCII text les; after all, our source code les are ASCII text les
with a special extension of .cpp
• Open your Lab 02 test data text le. Modify the text le as appropriate. Use your test data and step
through your pseudocode. Does everything seem to work? Have you missed something?
• When you are satised that you have your program plan and test data completed, close your text les.
That's right, I said, "Save and close your text les." Files should be properly closed before being used
by other software and this includes the Operating System software that moves, copies and renames
les.
• After you have successfully written this program, if you are taking this course for college credit, follow
the instructions from your professor/instructor for submitting it for grading.
2.4.6 Problems
2.4.6.1 Problem 02a Instructions
1. false
2. false
3. false
4. true
5. true
• Nothing
• Integer
• Floating-point
• Complex
The C++ programming language identies ve data types as standard data types:
• Void
• Boolean
• Character
• Integer
• Floating-point
The standard data types and the complex data types within C++ have a series of attributes, which include:
37
38 CHAPTER 3. 3. DATA & OPERATORS
• Operations Allowed i.e. Which operators can I use on the data type
Table 3.1
The ve standard data types usually exist in most programming languages and act or behave similarly
from language to language. Most courses of study for a programming course or language will explain the
standard data types rst. After they are learned, the complex data types are introduced.
The Boolean, character and integer data types are identied as belonging to the Integer Family. These
data types are all represented by integer numbers and thus act or behave similarly.
3.1.2 Denitions
Denition 3.1: data type
Denes a set of values and a set of operations that can be applied on those values.
These attributes vary from one programming language to another. The allowable characters and reserved
words will be dierent. The length limit refers to how many characters are allowed in an identier name
and often is compiler dependent and may vary from compiler to compiler for the same language. However,
all programming languages have these three technical rules.
Meaningful identier names make your code easier for another to understand. After all what does "p" mean?
Is it pi, price, pennies, etc. Thus do not use cryptic (look it up in the dictionary) identier names.
Some programming languages treat upper and lower case letters used in identier names as the same.
Thus: pig and Pig are treated as the same identier name. Unknown to you the programmer, the compiler
usually forces all identier names to upper case. Thus: pig and Pig both get changed to PIG. However
not all programming languages act this way. Some will treat upper and lower case letters as being dierent
things. Thus: pig and Pig are two dierent identier names. If you declare it as pig and then reference it in
be
your code later as Pig you get a compiler error. To avoid the problem altogether, we teach students to
case consistent. Use an identier name only once and spell it (upper and lower case) the same way within
your program.
These rules are decided by the industry (those who are using the programming language). The above rules
were commonly used within the "C" programming language and have to large degree carried over to C++.
1. literal constant
2. dened constant
3. memory constant
A literal constant is a value you type into your program wherever it is needed. Examples include the
constants used for initializing a variable and constants used in lines of code:
Additionally, we have learned how to recognize the data types of literal constants. Single quotes for char,
double quotes for string, number without a decimal point for integer, number with a decimal point belongs
to the oating-point family, and Boolean can use the reserved words of true or false.
In addition to literal constants, most text books refer to either symbolic constants or named constants
but these two refer to the same concept. A symbolic constant is represented by a name similar to how we
name variables. Let's say it backwards; the identier name is the symbol that represents the data item.
Within C++ identier names have some rules. One of the rules says those names should be meaningful.
Another rule about using ALL CAPS FOR CONSTANTS is an industry rule. There are two ways to create
symbolic or named constants:
#define PI 3.14159
Called a dened constant because it uses a textual substitution method controlled by the compiler
pre-processor command word "dene".
const double PI = 3.14159;
4 This content is available online at <http://cnx.org/content/m18719/1.8/>.
The second one is called sometimes called constant variable but that name is contradictory all by
itself. How can it be constant and vary at the same time? The better name for the second one is a memory
constant because they have a "specic storage location in memory".
3.3.3 Denitions
Denition 3.7: constant
A data item whose value cannot change during the program's execution.
3.4.2 Denitions
Denition 3.9: expression
A valid sequence of operand(s) and operator(s) that reduces (or evaluates) to a single value.
1. the symbols of + meaning addition and * meaning multiplication are our operators
2. the values 2, 3, 4 and 5 are our operands
3. precedence says that multiplication is higher than addition
4. thus, we evaluate the 3 * 4 to get 12
5. now we have: 2 + 12 + 5
6. the associativity rules say that addition goes left to right, thus we evaluate the 2 +12 to get 14
7. now we have: 14 + 5
8. nally, we evaluate the 14 + 5 to get 19; which is the value of the expression
Most operators are binary, that is they require two operands. Within C++ there is only one trinary operator,
the conditional. All of the unary operators are on the left side of the operand, except postx increment and
postx decrement. Some precedence charts indicate of which operators are unary and trinary and thus all
others are binary.
THE END.
cassell, petter, galpin & co., belle sauvage works, london, e.c.
FOOTNOTES:
[1] Petrus Damianus, Opusc., p. 5. Allix, Churches of Piedmont, p.
113. M’Crie, Hist. of Reform. in Italy, p. 2.
[2] Recent German criticism refers the Nobla Leyçon to a later
date, but still one anterior to the Reformation.
[3] The new and elegant temple of the Waldenses now rises near
the foot of the Castelluzzo.
[4] This short description of the Waldensian valleys is drawn from
the author’s personal observations.
[5] This disproves the charge of Manicheism brought against
them by their enemies.
[6] Sir Samuel Morland gives the Nobla Leyçon in full in his
History of the Churches of the Waldenses. Allix (chap. 18) gives a
summary of it.
[7] The Nobla Leyçon has the following passage:—“If there be an
honest man, who desires to love God and fear Jesus Christ, who
will neither slander, nor swear, nor lie, nor commit adultery, nor
kill, nor steal, nor avenge himself of his enemies, they presently
say of such a one he is a Vaudés, and worthy of death.”
[8] See a list of numerous heresies and blasphemies charged
upon the Waldenses by the Inquisitor Reynerius, who wrote about
the year 1250, and extracted by Allix (chap. 22).
[9] The Romaunt Version of the Gospel according to John, from
MS. preserved in Trinity College, Dublin, and in the Bibliothèque
du Roi, Paris. By William Stephen Gilly, D.D., Canon of Durham,
and Vicar of Norham. Lond., 1848.
[10] Stranski, apud, Lenfant’s Concile de Constance, quoted by
Count Valerian Krasinski in his History of the Rise, Progress, and
Decline of the Reformation in Poland, vol. i., p. 53; Lond., 1838.
Illyricus Flaccius, in his Catalogus Testium Veritatis (Amstelodami,
1679), says: “Pars Valdensium in Germaniam transiit atque apud
Bohemos, in Polonia ac Livonia sedem fixit.” Leger says that the
Waldenses had, about the year 1210, Churches in Slavonia,
Sarmatia, and Livonia. (Histoire Générale des Eglises Evangéliques
des Vallées du Piedmont ou Vaudois, vol. ii., pp. 336, 337; 1669.)
[11] M’Crie, Hist. Ref. in Italy, p. 4.
[12] Compare Antoine Monastier, History of the Vaudois Church,
p. 121 (Lond., 1848), with Alexis Muston, Israel of the Alps, p. 8
(Lond., 1852).
[13] Monastier, Hist. Vaudois Church, p. 123.
[14] Monastier, p. 123.
[15] Ibid.
[16] Monastier, p. 123.
[17] Histoire Générale des Eglises Evangéliques des Vallées de
Piedmont, ou Vaudoises. Par Jean Leger. Part ii., pp. 6, 7. Leyden,
1669. Monastier, pp. 123, 124.
[18] The bull is given in full in Leger, who also says that he had
made a faithful copy of it, and lodged it with other documents in
the University Library of Cambridge. (Hist. Gén. des Eglises Vaud.,
part ii., pp. 7-15.)
[19] Muston, Israel of the Alps, p. 10.
[20] Leger, livr. ii., p. 7.
[21] Leger, livr. ii., p. 26
[22] Monastier, p. 128.
[23] Muston, p. 20.
[24] Muston, part ii., p. 234.
[25] Monastier, p. 129.
[26] Monastier, p. 130.
[27] Monastier, pp. 133-4.
[28] Monastier, p. 134.
[29] The Author was shown this pool when he visited the chasm.
None of the Waldensian valleys is better illustrated by the sad, yet
glorious, scenes of their martyrdom than this Valley of Angrogna.
Every rock in it has its story. As you pass through it you are
shown the spot where young children were dashed against the
stones—the spot where men and women, stripped naked, were
rolled up as balls, and precipitated down the mountain, and
where, caught by the stump of tree, or projecting angle of rock,
they hung transfixed, enduring for days the agony of a living
death. You are shown the entrance of caves, into which some
hundreds of the Vaudois having fled, their enemies, lighting a fire
at the mouth of their hiding place, ruthlessly killed them all. Time
would fail to tell even a tithe of what has been done and suffered
in this famous pass.
[30] Muston, p. 11.
[31] Leger, livr. ii., p. 26.
[32] Ibid.
[33] Leger and Gilles say that it was Philip VII. who put an end to
this war. Monastier says they “are mistaken, for this prince was
then in France, and did not begin to reign till 1496.” This peace
was granted in 1489.
[34] Monastier, Hist. of the Vaudois, p. 138.
[35] Monastier, Hist. of the Vaudois, p. 138.
[36] Gilles, p. 30. Monastier, p. 141.
[37] Ruchat, tom. iii., pp. 176, 557.
[38] Hist. of the Vaud., p. 146.
[39] It is entitled, says Leger, “A Brief Confession of Faith made
by the Pastors and Heads of Families of the Valleys of Piedmont.”
“It is preserved,” he adds, “with other documents, in the Library
of the University of Cambridge.” (Hist. des Vaud., livr. i., p. 95.)
[40] Gilles, p. 40. Monastier, p. 146.
[41] George Morel states, in his Memoirs, that at this time there
were more than 800,000 persons of the religion of the Vaudois.
(Leger, Hist. des Vaudois, livr. ii., p. 27.) He includes, of course, in
this estimate the Vaudois in the Valleys, on the plain of Piedmont,
in Naples and Calabria, in the South of France, and in the
countries of Germany.
[42] Leger, livr. ii., p. 27.
[43] Monastier, p. 153.
[44] Leger, livr. ii., p. 29.
[45] Leger, livr. ii., p. 29. Monastier, p. 168,
[46] Leger, livr. ii., p. 28.
[47] Muston, Israel of the Alps, chap. 8.
[48] Leger, livr. ii., p. 29.
[49] Monastier, chap. 19, p. 172. Muston, chap. 10., p. 52.
[50] Leger, livr. ii., p. 29.
[51] “First, we do protest before the Almighty and All-just God,
before whose tribunal we must all one day appear, that we intend
to live and die in the holy faith, piety, and religion of our Lord
Jesus Christ, and that we do abhor all heresies that have been,
and are, condemned by the Word of God. We do embrace the
most holy doctrine of the prophets and apostles, as likewise of
the Nicene and Athanasian Creeds; we do subscribe to the four
Councils, and to all the ancient Fathers, in all such things as are
not repugnant to the analogy of faith.” (Leger, livr. ii., pp. 30-1.)
[52] See in Leger (livr. ii., pp. 30-1) the petition of the Vaudois
presented “Au Sérènissime et très-Puissant Prince, Philibert
Emmanuel, Duc de Savoye, Prince de Piémont, nôtre très-Clement
Seigneur” (To the Serene and most Mighty Prince, Philibert
Emmanuel, Duke of Savoy, Prince of Piedmont, our most Gracious
Lord).
[53] See in Leger (livr. ii., p. 32), “A la très-Vertueuse et très-
Excellente Dame, Madame Marguerite de France, Duchesse de
Savoye et de Berry”—“the petition of her poor and humble
subjects, the inhabitants of the Valleys of Lucerna and Angrogna,
and Perosa and San Martino, and all those of the plain who call
purely upon the name of the Lord Jesus.”
[54] Muston, p. 68.
[55] Muston, p. 72.
[56] Muston, p. 69. Monastier, p. 178.
[57] Muston, p. 70. Monastier, pp. 176-7.
[58] Muston, p. 71. Monastier, pp. 177-8.
[59] Muston, p. 72. Monastier, p. 182.
[60] Letter of Scipio Lentullus, Pastor of San Giovanni. (Leger,
Hist. des Eglises Vaud., livr. ii., p. 35.)
[61] So says the Pastor of Giovanni, Scipio Lentullus, in the letter
already referred to. (Leger, livr. ii., p. 35.)
[62] Letter of Scipio Lentullus. (Leger, livr. ii., p. 35.) Muston, pp.
73-4.
[63] Leger, livr. ii., p. 35. Monastier, pp. 184-5.
[64] Leger, livr. ii., p. 35.
[65] Muston, p. 77. Monastier, pp. 186-7.
[66] Muston, p. 78.
[67] Monastier, p. 188. Muston, p. 78.
[68] Muston, pp. 78-9.
[69] Monastier, p. 190. Muston, p. 80.
[70] Monastier, p. 191.
[71] Leger, part ii., p. 36. Gilles, chap. 25.
[72] Ibid., part ii., p. 37.
[73] Muston, p. 83.
[74] Ibid. Monastier, p. 194.
[75] Leger, part ii., p. 37. Muston, p. 85.
[76] The Articles of Capitulation are given in full in Leger, part ii.,
pp. 38-40.
[77] Leger, part ii., p. 41.
[78] Muston, p. 37.
[79] Leger, part ii., p. 333.
[80] M’Crie, Italy, pp. 7, 8.
[81] Muston, Israel of the Alps, p. 38.
[82] Perrin, Histoire des Vaudois, p. 197. Monastier, pp. 203-4.
[83] Muston, p. 38. Monastier and M’Crie say that the application
for a pastor was made to Geneva, and that Paschale set out for
Calabria, accompanied by another minister and two
schoolmasters. It is probable that the application was made to
Geneva through the intermediation of the home Church.
[84] M’Crie, p. 324.
[85] Monastier, p. 205.
[86] M’Crie, p. 325.
[87] M’Crie, pp. 325-7.
[88] Ibid., pp. 326-7.
[89] Leger, part ii., p. 333. M’Crie, p. 303. Muston, p. 41.
[90] Monastier, p. 206.
[91] M’Crie, p. 304.
[92] Pantaleon, Rerum in Eccles. Gest. Hist., ff. 337-8. De Porta,
tom. ii., pp. 309, 312—ex M’Crie, pp. 305-6.
[93] Crespin, Hist. des Martyrs, pp. 506-16. Leger, part i., p. 204,
and part ii., p. 335.
[94] Sextus Propertius (Cranstoun’s translation), p. 119.
[95] Muston, chap. 16. Monastier, chap. 21.
[96] See the letter in full in Leger, part i., pp. 41-5.
[97] Muston, p. 98.
[98] Monastier, p. 222.
[99] Muston, p. 111.
[100] Monastier, p. 241.
[101] Muston, pp. 112-3. Antoine Leger was uncle of Leger the
historian. He had been tutor for many years in the family of the
Ambassador of Holland at Constantinople.
[102] Monastier, chap. 18. Muston pp. 242-3.
[103] Muston, p. 126.
[104] Muston, p. 129.
[105] Leger, part ii., chap. 6, pp. 72-3.
[106] Muston, p. 130.
[107] Leger, part ii., chap. 8, p. 94.
[108] Monastier, p. 265.
[109] Leger, part ii., pp. 95-6.
[110] Ibid., part iv., p. 108.
[111] Monastier, p. 267.
[112] Muston, p. 135.
[113] Leger, part ii., pp. 108-9.
[114] Leger, part ii., p. 110.
[115] So says Leger, who was an eye-witness of these horrors.
[116] Monastier, p. 270.
[117] Leger, part ii., p. 113.
[118] Leger, part ii., p. 111.
[119] Leger, part ii., p. 112.
[120] The book is that from which we have so largely quoted,
entitled Histoire Générale des Eglises Evangéliques des Vallées de
Piémont ou Vaudoises. Par Jean Leger, Pasteur et Modérateur des
Eglises des Vallées, et depuis la violence de la Persécution, appelé
à l’Eglise Wallonne de Leyde. A. Leyde, 1669.
[121] Leger, part ii., p. 113.
[122] The sum collected in England was, in round numbers,
£38,000. Of this, £16,000 was invested, on the security of the
State, to pension pastors, schoolmasters, and students in the
Valleys. This latter sum was appropriated by Charles II., on the
pretext that he was not bound to implement the engagements of
a usurper.
[123] The History of the Evangelical Churches of the Valleys of
Piedmont: containing a most exact Geographical Description of
the place, and a faithful Account of the Doctrine, Life, and
Persecutions of the ancient Inhabitants, together with a most
naked and punctual Relation of the late bloody Massacre, 1655.
By Samuel Morland, Esq., His Highness’ Commissioner
Extraordinary for the Affairs of the said Valleys. London, 1658.
[124] Leger, part ii., chap. 11, p. 186.
[125] Leger, part ii., pp. 186-7.
[126] Leger, part ii., p. 187. Muston, pp. 146-7.
[127] Leger, part ii., p. 188. Muston, pp. 148-9.
[128] Leger, part ii., p. 189. Monastier, p. 277.
[129] Leger, part ii., p. 189.
[130] Leger, part ii., p. 275.
[131] Monastier, p. 311.
[132] Monastier, p. 317. Muston, p. 199.
[133] Muston, p. 200.
[134] Muston, p. 202.
[135] Monastier, p. 320.
[136] Monastier, p. 336.
[137] So named by the author of the Rentrée, from the village at
its foot, but which without doubt, says Monastier (p. 349), “is
either the Col Joli (7,240 feet high) or the Col de la Fénêtre, or
Portetta, as it was named to Mr. Brockedon, who has visited these
countries, and followed the same road as the Vaudois.”
[138] Monastier, p. 352.
[139] Monastier, p. 356.
[140] Monastier, pp. 364-5.
[141] The Author was conducted over the ground, and had all the
memorials of the siege pointed out to him by two most
trustworthy and intelligent guides—M. Turin, then Pastor of Macel,
whose ancestors had figured in the “Glorious Return;” and the
late M. Tron, Syndic of the Commune. The ancestors of M. Tron
had returned with Henri Arnaud, and recovered their lands in the
Valley of San Martino, and here had the family of M. Tron lived
ever since, and the precise spots where the more memorable
events of the war had taken place had been handed down from
father to son.
[142] Monastier, pp. 369, 370.
[143] Cannon-balls are occasionally picked up in the
neighbourhood of the Balsiglia. In 1857 the Author was shown
one in the Presbytère of Pomaretto, which had been dug up a
little before.
[144] Monastier, p. 371.
[145] Monastier, p. 389. The Pope, Innocent XII., declared (19th
August, 1694) the edict of the duke re-establishing the Vaudois
null and void, and enjoined his inquisitors to pay no attention to it
in their pursuit of the heretics.
[146] Muston, pp. 220-1. Monastier, pp. 388-9.
[147] Waldensian Researches, by William Stephen Gilly, M.A.,
Prebendary of Durham; p. 158; Lond., 1831.
[148] So deep was the previous ignorance respecting this people,
that Sharon Turner, speaking of the Waldenses in his History of
England, placed them on the shores of Lake Leman, confounding
the Valleys of the Vaudois with the Canton de Vaud.
[149] The Author may be permitted to bear his personal
testimony to the labours of General Beckwith for the Waldenses,
and through them for the evangelisation of Italy. On occasion of