100% found this document useful (4 votes)
252 views

(eBook PDF) Starting Out with C++: From Control Structures through Objects 8th Edition instant download

The document is a comprehensive guide to learning C++, covering topics from basic programming concepts to advanced object-oriented programming techniques. It includes chapters on control structures, functions, arrays, classes, and data structures, along with practical examples and case studies. Additionally, it provides links to various editions of related eBooks for further study.

Uploaded by

biprolarebo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
252 views

(eBook PDF) Starting Out with C++: From Control Structures through Objects 8th Edition instant download

The document is a comprehensive guide to learning C++, covering topics from basic programming concepts to advanced object-oriented programming techniques. It includes chapters on control structures, functions, arrays, classes, and data structures, along with practical examples and case studies. Additionally, it provides links to various editions of related eBooks for further study.

Uploaded by

biprolarebo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

(eBook PDF) Starting Out with C++: From Control

Structures through Objects 8th Edition pdf


download

https://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-through-objects-8th-edition/

Download more ebook from https://ebooksecure.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebooksecure.com
to discover even more!

(eBook PDF) Starting Out with C++: From Control


Structures through Objects, Brief Version 8th Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-through-objects-brief-version-8th-
edition/

(eBook PDF) Starting Out with Java: From Control


Structures through Objects, 7th Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
from-control-structures-through-objects-7th-edition/

(eBook PDF) Starting Out with C++ from Control


Structures to Objects 9th Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-to-objects-9th-edition/

(eBook PDF) Starting Out with Java: From Control


Structures through Data Structures 3rd Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
from-control-structures-through-data-structures-3rd-edition/
(eBook PDF) Starting Out with Java: From Control
Structures through Data Structures 4th Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
from-control-structures-through-data-structures-4th-edition/

(eBook PDF) Starting Out with C++: Early Objects 9th


Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
early-objects-9th-edition/

Starting Out with C++: Early Objects 9th Edition by


Tony Gaddis (eBook PDF)

http://ebooksecure.com/product/starting-out-with-c-early-
objects-9th-edition-by-tony-gaddis-ebook-pdf/

(eBook PDF) Starting Out with Java: Early Objects 5th


Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
early-objects-5th-edition/

(eBook PDF) Starting Out with Java: Early Objects 5th


Global Edition

http://ebooksecure.com/product/ebook-pdf-starting-out-with-java-
early-objects-5th-global-edition/
Contents

Preface xv

CHAPTER 1 Introduction to Computers and Programming 1


1.1 Why Program? 1
1.2 Computer Systems: Hardware and Software 2
1.3 Programs and Programming Languages 8
1.4 What Is a Program Made of? 14
1.5 Input, Processing, and Output 17
1.6 The Programming Process 18
1.7 Procedural and Object-Oriented Programming 22

CHAPTER 2 Introduction to C++ 27


2.1 The Parts of a C++ Program 27
2.2 The cout Object 31
2.3 The #include Directive 36
2.4 Variables and Literals 37
2.5 Identifiers 41
2.6 Integer Data Types 42
2.7 The char Data Type 48
2.8 The C++ string Class 52
2.9 Floating-Point Data Types 54
2.10 The bool Data Type 57
2.11 Determining the Size of a Data Type 58
2.12 Variable Assignments and Initialization 59
2.13 Scope 61
2.14 Arithmetic Operators 61
2.15 Comments 69
2.16 Named Constants 71
2.17 Programming Style 73

vii
viii Contents

CHAPTER 3 Expressions and Interactivity 83


3.1 The cin Object 83
3.2 Mathematical Expressions 89
3.3 When You Mix Apples and Oranges: Type Conversion 98
3.4 Overflow and Underflow 100
3.5 Type Casting 101
3.6 Multiple Assignment and Combined Assignment 104
3.7 Formatting Output 108
3.8 Working with Characters and string Objects 118
3.9 More Mathematical Library Functions 124
3.10 Focus on Debugging: Hand Tracing a Program 130
3.11 Focus on Problem Solving: A Case Study 132

CHAPTER 4 Making Decisions 149


4.1 Relational Operators 149
4.2 The if Statement 154
4.3 Expanding the if Statement 162
4.4 The if/else Statement 166
4.5 Nested if Statements 169
4.6 The if/else if Statement 176
4.7 Flags 181
4.8 Logical Operators 182
4.9 Checking Numeric Ranges with Logical Operators 189
4.10 Menus 190
4.11 Focus on Software Engineering: Validating User Input 193
4.12 Comparing Characters and Strings 195
4.13 The Conditional Operator 199
4.14 The switch Statement 202
4.15 More About Blocks and Variable Scope 211

CHAPTER 5 Loops and Files 227


5.1 The Increment and Decrement Operators 227
5.2 Introduction to Loops: The while Loop 232
5.3 Using the while Loop for Input Validation 239
5.4 Counters 241
5.5 The do-while Loop 242
5.6 The for Loop 247
5.7 Keeping a Running Total 257
5.8 Sentinels 260
5.9 Focus on Software Engineering: Deciding Which Loop to Use 261
5.10 Nested Loops 262
5.11 Using Files for Data Storage 265
5.12 Optional Topics: Breaking and Continuing a Loop 284

CHAPTER 6 Functions 299


6.1 Focus on Software Engineering: Modular Programming 299
6.2 Defining and Calling Functions 300
6.3 Function Prototypes 309
6.4 Sending Data into a Function 311
Contents ix

6.5 Passing Data by Value 316


6.6 Focus on Software Engineering: Using Functions in a
Menu-Driven Program 318
6.7 The return Statement 322
6.8 Returning a Value from a Function 324
6.9 Returning a Boolean Value 332
6.10 Local and Global Variables 334
6.11 Static Local Variables 342
6.12 Default Arguments 345
6.13 Using Reference Variables as Parameters 348
6.14 Overloading Functions 354
6.15 The exit() Function 358
6.16 Stubs and Drivers 361

CHAPTER 7 Arrays 375


7.1 Arrays Hold Multiple Values 375
7.2 Accessing Array Elements 377
7.3 No Bounds Checking in C++ 384
7.4 Array Initialization 387
7.5 The Range-Based for Loop 392
7.6 Processing Array Contents 396
7.7 Focus on Software Engineering: Using Parallel Arrays 404
7.8 Arrays as Function Arguments 407
7.9 Two-Dimensional Arrays 418
7.10 Arrays with Three or More Dimensions 425
7.11 Focus on Problem Solving and Program Design: A Case Study 427
7.12 If You Plan to Continue in Computer Science: Introduction to the
STL vector 429

CHAPTER 8 Searching and Sorting Arrays 457


8.1 Focus on Software Engineering: Introduction to Search Algorithms 457
8.2 Focus on Problem Solving and Program Design: A Case Study 463
8.3 Focus on Software Engineering: Introduction to Sorting Algorithms 470
8.4 Focus on Problem Solving and Program Design: A Case Study 477
8.5 If You Plan to Continue in Computer Science: Sorting and
Searching vectors 485

CHAPTER 9 Pointers 495


9.1 Getting the Address of a Variable 495
9.2 Pointer Variables 497
9.3 The Relationship Between Arrays and Pointers 504
9.4 Pointer Arithmetic 508
9.5 Initializing Pointers 510
9.6 Comparing Pointers 511
9.7 Pointers as Function Parameters 513
9.8 Focus on Software Engineering: Dynamic Memory Allocation 522
9.9 Focus on Software Engineering: Returning Pointers from Functions 526
9.10 Using Smart Pointers to Avoid Memory Leaks 533
9.11 Focus on Problem Solving and Program Design: A Case Study 536
x Contents

CHAPTER 10 Characters, C-Strings, and More About the string Class 547
10.1 Character Testing 547
10.2 Character Case Conversion 551
10.3 C-Strings 554
10.4 Library Functions for Working with C-Strings 558
10.5 C-String/Numeric Conversion Functions 569
10.6 Focus on Software Engineering: Writing Your Own
C-String-Handling Functions 575
10.7 More About the C++ string Class 581
10.8 Focus on Problem Solving and Program Design: A Case Study 590

CHAPTER 11 Structured Data 599


11.1 Abstract Data Types 599
11.2 Focus on Software Engineering: Combining Data into Structures 601
11.3 Accessing Structure Members 604
11.4 Initializing a Structure 608
11.5 Arrays of Structures 611
11.6 Focus on Software Engineering: Nested Structures 613
11.7 Structures as Function Arguments 617
11.8 Returning a Structure from a Function 620
11.9 Pointers to Structures 623
11.10 Focus on Software Engineering: When to Use ., When to Use ->,
and When to Use * 626
11.11 Unions 628
11.12 Enumerated Data Types 632

CHAPTER 12 Advanced File Operations 657


12.1 File Operations 657
12.2 File Output Formatting 663
12.3 Passing File Stream Objects to Functions 665
12.4 More Detailed Error Testing 667
12.5 Member Functions for Reading and Writing Files 670
12.6 Focus on Software Engineering: Working with Multiple Files 678
12.7 Binary Files 680
12.8 Creating Records with Structures 685
12.9 Random-Access Files 689
12.10 Opening a File for Both Input and Output 697

CHAPTER 13 Introduction to Classes 711


13.1 Procedural and Object-Oriented Programming 711
13.2 Introduction to Classes 718
13.3 Defining an Instance of a Class 723
13.4 Why Have Private Members? 736
13.5 Focus on Software Engineering: Separating Class Specification
from Implementation 737
13.6 Inline Member Functions 743
13.7 Constructors 746
13.8 Passing Arguments to Constructors 750
Contents xi

13.9 Destructors 758


13.10 Overloading Constructors 762
13.11 Private Member Functions 765
13.12 Arrays of Objects 767
13.13 Focus on Problem Solving and Program Design: An OOP Case Study 771
13.14 Focus on Object-Oriented Programming: Simulating Dice with Objects 778
13.15 Focus on Object-Oriented Programming: Creating an Abstract Array
Data Type 782
13.16 Focus on Object-Oriented Design: The Unified Modeling Language (UML) 785
13.17 Focus on Object-Oriented Design: Finding the Classes and Their
Responsibilities 788

CHAPTER 14 More About Classes 811


14.1 Instance and Static Members 811
14.2 Friends of Classes 819
14.3 Memberwise Assignment 824
14.4 Copy Constructors 825
14.5 Operator Overloading 831
14.6 Object Conversion 858
14.7 Aggregation 860
14.8 Focus on Object-Oriented Design: Class Collaborations 865
14.9 Focus on Object-Oriented Programming: Simulating the Game
of Cho-Han 869

CHAPTER 15 Inheritance, Polymorphism, and Virtual Functions 891


15.1 What Is Inheritance? 891
15.2 Protected Members and Class Access 900
15.3 Constructors and Destructors in Base and Derived Classes 906
15.4 Redefining Base Class Functions 918
15.5 Class Hierarchies 923
15.6 Polymorphism and Virtual Member Functions 929
15.7 Abstract Base Classes and Pure Virtual Functions 945
15.8 Multiple Inheritance 952

CHAPTER 16 Exceptions, Templates, and the Standard Template


Library (STL) 971
16.1 Exceptions 971
16.2 Function Templates 990
16.3 Focus on Software Engineering: Where to Start When Defining Templates 996
16.4 Class Templates 996
16.5 Introduction to the Standard Template Library (STL) 1005

CHAPTER 17 Linked Lists 1025


17.1 Introduction to the Linked List ADT 1025
17.2 Linked List Operations 1027
17.3 A Linked List Template 1043
17.4 Variations of the Linked List 1055
17.5 The STL list Container 1056
xii Contents

CHAPTER 18 Stacks and Queues 1063


18.1 Introduction to the Stack ADT 1063
18.2 Dynamic Stacks 1080
18.3 The STL stack Container 1091
18.4 Introduction to the Queue ADT 1093
18.5 Dynamic Queues 1105
18.6 The STL deque and queue Containers 1112

CHAPTER 19 Recursion 1121


19.1 Introduction to Recursion 1121
19.2 Solving Problems with Recursion 1125
19.3 Focus on Problem Solving and Program Design: The Recursive
gcd Function 1133
19.4 Focus on Problem Solving and Program Design: Solving Recursively
Defined Problems 1134
19.5 Focus on Problem Solving and Program Design: Recursive Linked List
Operations 1135
19.6 Focus on Problem Solving and Program Design: A Recursive Binary
Search Function 1139
19.7 The Towers of Hanoi 1141
19.8 Focus on Problem Solving and Program Design: The QuickSort Algorithm 1144
19.9 Exhaustive Algorithms 1148
19.10 Focus on Software Engineering: Recursion vs. Iteration 1151

CHAPTER 20 Binary Trees 1155


20.1 Definition and Applications of Binary Trees 1155
20.2 Binary Search Tree Operations 1158
20.3 Template Considerations for Binary Search Trees 1175

Appendix A: Getting Started with Alice 1185


Appendix B: The ASCII Character Set 1211
Appendix C: Operator Precedence and Associativity 1213
Quick References 1215
Index 1217
Credit 1237

Online The following appendices are available at www.pearsonhighered.com/gaddis.


Appendix D: Introduction to Flowcharting
Appendix E: Using UML in Class Design
Appendix F: Namespaces
Appendix G: Passing Command Line Arguments
Appendix H: Header File and Library Function Reference
Appendix I: Binary Numbers and Bitwise Operations
Appendix J: Multi-Source File Programs
Appendix K: Stream Member Functions for Formatting
Appendix L: Answers to Checkpoints
Appendix M: Solutions to Odd-Numbered Review Questions
LOCATION OF VIDEONOTES IN THE TEXT

Chapter 1 Introduction to Flowcharting, p. 20


Designing a Program with Pseudocode, p. 20
Designing the Account Balance Program, p. 25
Predicting the Result of Problem 33, p. 26
Chapter 2 Using cout, p. 31
Variabe Definitions, p. 37
Assignment Statements and Simple Math Expressions, p. 62
Solving the Restaurant Bill Problem, p. 80
Chapter 3 Reading Input with cin, p. 83
Formatting Numbers with setprecision, p. 111
Solving the Stadium Seating Problem, p. 142
Chapter 4 The if Statement, p. 154
The if/else statement, p. 166
The if/else if Statement, p. 176
Solving the Time Calculator Problem, p. 221
Chapter 5 The while Loop, p. 232
The for Loop, p. 247
Reading Data from a File, p. 274
Solving the Calories Burned Problem, p. 293
Chapter 6 Functions and Arguments, p. 311
Value-Returnlng Functions, p. 324
Solving the Markup Problem, p. 366
Chapter 7 Accessing Array Elements With a Loop, p. 380
Passing an Array to a Function, p. 407
Solving the Chips and Salsa Problem, p. 448
Chapter 8 The Binary Search, p. 460
The Selection Sort, p. 474
Solving the Charge Account Validation Modification Problem, p. 492
Chapter 9 Dynamically Allocating an Array, p. 523
Solving the Pointer Rewrite Problem, p. 545
Chapter 10 Writing a C-String-Handling Function, p. 575
More About the string Class, p. 581
Solving the Backward String Problem, p. 594
(continued on the next page)
LOCATION OF VIDEONOTES IN THE TEXT (continued)

Chapter 11 Creating a Structure, p. 601


Passing a Structure to a Function, p. 617
Solving the Weather Statistics Problem, p. 652
Chapter 12 Passing File Stream Objects to Functions, p. 665
Working with Multiple Files, p. 678
Solving the File Encryption Filter Problem, p. 708
Chapter 13 Writing a Class, p. 718
Defining an Instance of a Class, p. 723
Solving the Employee Class Problem, p. 802
Chapter 14 Operator Overloading, p. 831
Class Aggregation, p. 860
Solving the NumDays Problem, p. 885
Chapter 15 Redefining a Base Class Function in a Derived Class, p. 918
Polymorphism, p. 929
Solving the Employee and Production-Worker Classes Problem, p. 963
Chapter 16 Throwing an Exception, p. 972
Handling an Exception, p. 972
Writing a Function Template, p. 990
Storing Objects in a vector, p. 1010
Solving the Exception Project Problem, p. 1024
Chapter 17 Appending a Node to a Linked List, p. 1028
Inserting a Node in a Linked List, p. 1035
Deleting a Node from a Linked List, p. 1039
Solving the Member Insertion by Position Problem, p. 1061
Chapter 18 Storing Objects in an STL stack, p. 1091
Storing Objects in an STL queue, p. 1114
Solving the File Compare Problem, p. 1119
Chapter 19 Reducing a Problem with Recursion, p. 1126
Solving the Recursive Multiplication Problem, p. 1153
Chapter 20 Inserting a Node in a Binary Tree, p. 1160
Deleting a Node from a Binary Tree, p. 1166
Solving the Node Counter Problem, p. 1182
Preface

Welcome to Starting Out with C++: From Control Structures through Objects, 8th edition.
This book is intended for use in a two-semester C++ programming sequence, or an acceler-
ated one-semester course. Students new to programming, as well as those with prior course
work in other languages, will find this text beneficial. The fundamentals of programming
are covered for the novice, while the details, pitfalls, and nuances of the C++ language are
explored in-depth for both the beginner and more experienced student. The book is written
with clear, easy-to-understand language, and it covers all the necessary topics for an intro-
ductory programming course. This text is rich in example programs that are concise, practi-
cal, and real-world oriented, ensuring that the student not only learns how to implement the
features and constructs of C++, but why and when to use them.

Changes in the Eighth Edition


C++11 is the latest standard version of the C++ language. In previous years, while the stan-
dard was being developed, it was known as C++0x. In August 2011, it was approved by
the International Standards Organization (ISO), and the name of the standard was officially
changed to C++11. Most of the popular compilers now support the C++11 standard.
The new C++11 standard was the primary motivation behind this edition. Although this
edition introduces many of the new language features, a C++11 compiler is not strictly
required to use the book. As you progress through the book, you will see C++11 icons in the
margins, next to the new features that are introduced. Programs appearing in sections that
are not marked with this icon will still compile using an older compiler.
Here is a summary of the new C++11 topics that are introduced in this edition:
● The auto key word is introduced as a way to simplify complex variable definitions.
The auto key word causes the compiler to infer a variable’s data type from its initial-
ization value.
● The long long int and unsigned long long int data types, and the LL literal
suffix are introduced.
● Chapter 5 shows how to pass a string object directly to a file stream object’s open
member function, without the need to call the c_str() member function. (A discus-
sion of the c_str()function still exists for anyone using a legacy compiler.)

xv
xvi Preface

● The range-based for loop is introduced in Chapter 7. This new looping mechanism
automatically iterates over each element of an array, vector, or other collection,
without the need of a counter variable or a subscript.
● Chapter 7 shows how a vector can be initialized with an initialization list.
● The nullptr key word is introduced as the standard way of representing a null
pointer.
● Smart pointers are introduced in Chapter 9, with an example of dynamic memory
allocation using unique_ptr.
● Chapter 10 discusses the new, overloaded to_string functions for converting numeric
values to string objects.
● The string class’s new back() and front() member functions are included in
Chapter 10’s overview of the string class.
● Strongly typed enums are discussed in Chapter 11.
● Chapter 13 shows how to use the smart pointer unique_ptr to dynamically allocate
an object.
● Chapter 15 discusses the override key word and demonstrates how it can help prevent
subtle overriding errors. The final key word is discussed as a way of preventing a virtual
member function from being overridden.
In addition to the C++11 topics, the following general improvements were made:
● Several new programming problems have been added to the text, and many of the
existing programming problems have been modified to make them unique from previ-
ous editions.
● The discussion of early, historic computers in Chapter 1 is expanded.
● The discussion of literal values in Chapter 2 is improved.
● The introduction of the char data type in Chapter 2 is reorganized to use character
literals in variable assignments before using ASCII values in variable assignments.
● The discussion of random numbers in Chapter 3 is expanded and improved, with the
addition of a new In the Spotlight section.
● A new Focus on Object-Oriented Programming section has been added to Chapter 13,
showing how to write a class that simulates dice.
● A new Focus on Object-Oriented Programming section has been added to Chapter 14,
showing an object-oriented program that simulates the game of Cho-Han. The program
uses objects for the dealer, two players, and a pair of dice.

Organization of the Text


This text teaches C++ in a step-by-step fashion. Each chapter covers a major set of topics
and builds knowledge as the student progresses through the book. Although the chapters
can be easily taught in their existing sequence, some flexibility is provided. The diagram
shown in Figure P-1 suggests possible sequences of instruction.
Preface xvii

Figure P-1

Chapter 1
Introduction

Chapters 2–7
Basic Language
Elements

Chapter 8 Chapter 9 Chapter 12


Searching and Pointers Advanced File
Sorting Arrays Operations*

*A few subtopics in
Chapter 12 require
Chapter 10 Chapters 9 and 11.
Characters, Strings, Chapter 11
and the string Class Structures

Chapter 13
Introduction to
Classes

Chapter 14
More About Classes

Chapter 15
Inheritance and
Polymorphism

Chapter 16
Exceptions,
Templates, and STL

Chapter 17
Linked Lists

Chapter 18 Chapter 19
Stacks and Queues Recursion

Chapter 20
Binary Trees
xviii Preface

Chapter 1 covers fundamental hardware, software, and programming concepts. You may
choose to skip this chapter if the class has already mastered those topics. Chapters 2 through
7 cover basic C++ syntax, data types, expressions, selection structures, repetition structures,
functions, and arrays. Each of these chapters builds on the previous chapter and should be
covered in the order presented.
After Chapter 7 has been covered, you may proceed to Chapter 8, or jump to either Chapter
9 or Chapter 12. (If you jump to Chapter 12 at this point, you will need to postpone sections
12.7, 12.8, and 12.10 until Chapters 9 and 11 have been covered.)
After Chapter 9 has been covered, either of Chapters 10 or 11 may be covered. After Chap-
ter 11, you may cover Chapters 13 through 17 in sequence. Next you can proceed to either
Chapter 18 or Chapter 19. Finally, Chapter 20 may be covered.
This text’s approach starts with a firm foundation in structured, procedural programming
before delving fully into object-oriented programming and advanced data structures.

Brief Overview of Each Chapter


Chapter 1: Introduction to Computers and Programming
This chapter provides an introduction to the field of computer science and covers the fun-
damentals of programming, problem solving, and software design. The components of pro-
grams, such as key words, variables, operators, and punctuation are covered. The tools of
the trade, such as pseudocode, flow charts, and hierarchy charts are also presented.

Chapter 2: Introduction to C++


This chapter gets the student started in C++ by introducing data types, identifiers, vari-
able declarations, constants, comments, program output, simple arithmetic operations, and
C-strings. Programming style conventions are introduced and good programming style
is modeled here, as it is throughout the text. An optional section explains the difference
between ANSI standard and pre-standard C++ programs.

Chapter 3: Expressions and Interactivity


In this chapter the student learns to write programs that input and handle numeric, char-
acter, and string data. The use of arithmetic operators and the creation of mathematical
expressions are covered in greater detail, with emphasis on operator precedence. Debug-
ging is introduced, with a section on hand tracing a program. Sections are also included on
simple output formatting, on data type conversion and type casting, and on using library
functions that work with numbers.

Chapter 4: Making Decisions


Here the student learns about relational operators, relational expressions and how to con-
trol the flow of a program with the if, if/else, and if/else if statements. The condi-
tional operator and the switch statement are also covered. Crucial applications of these
constructs are covered, such as menu-driven programs and the validation of input.
Preface xix

Chapter 5: Loops and Files


This chapter covers repetition control structures. The while loop, do-while loop, and for
loop are taught, along with common uses for these devices. Counters, accumulators, run-
ning totals, sentinels, and other application-related topics are discussed. Sequential file I/O
is also introduced. The student learns to read and write text files, and use loops to process
the data in a file.

Chapter 6: Functions
In this chapter the student learns how and why to modularize programs, using both void
and value returning functions. Argument passing is covered, with emphasis on when argu-
ments should be passed by value versus when they need to be passed by reference. Scope of
variables is covered, and sections are provided on local versus global variables and on static
local variables. Overloaded functions are also introduced and demonstrated.

Chapter 7: Arrays
In this chapter the student learns to create and work with single and multidimensional
arrays. Many examples of array processing are provided including examples illustrating
how to find the sum, average, highest, and lowest values in an array and how to sum the
rows, columns, and all elements of a two-dimensional array. Programming techniques using
parallel arrays are also demonstrated, and the student is shown how to use a data file as
an input source to populate an array. STL vectors are introduced and compared to arrays.

Chapter 8: Sorting and Searching Arrays


Here the student learns the basics of sorting arrays and searching for data stored in them.
The chapter covers the Bubble Sort, Selection Sort, Linear Search, and Binary Search algo-
rithms. There is also a section on sorting and searching STL vector objects.

Chapter 9: Pointers
This chapter explains how to use pointers. Pointers are compared to and contrasted with
reference variables. Other topics include pointer arithmetic, initialization of pointers, rela-
tional comparison of pointers, pointers and arrays, pointers and functions, dynamic mem-
ory allocation, and more.

Chapter 10: Characters, C-strings, and More About the string Class
This chapter discusses various ways to process text at a detailed level. Library functions for
testing and manipulating characters are introduced. C-strings are discussed, and the tech-
nique of storing C-strings in char arrays is covered. An extensive discussion of the string
class methods is also given.

Chapter 11: Structured Data


The student is introduced to abstract data types and taught how to create them using struc-
tures, unions, and enumerated data types. Discussions and examples include using pointers
to structures, passing structures to functions, and returning structures from functions.
xx Preface

Chapter 12: Advanced File Operations


This chapter covers sequential access, random access, text, and binary files. The various
modes for opening files are discussed, as well as the many methods for reading and writing
file contents. Advanced output formatting is also covered.

Chapter 13: Introduction to Classes


The student now shifts focus to the object-oriented paradigm. This chapter covers the fun-
damental concepts of classes. Member variables and functions are discussed. The student
learns about private and public access specifications, and reasons to use each. The topics of
constructors, overloaded constructors, and destructors are also presented. The chapter pres-
ents a section modeling classes with UML and how to find the classes in a particular problem.

Chapter 14: More About Classes


This chapter continues the study of classes. Static members, friends, memberwise assign-
ment, and copy constructors are discussed. The chapter also includes in-depth sections on
operator overloading, object conversion, and object aggregation. There is also a section on
class collaborations and the use of CRC cards.

Chapter 15: Inheritance, Polymorphism, and Virtual Functions


The study of classes continues in this chapter with the subjects of inheritance, polymor-
phism, and virtual member functions. The topics covered include base and derived class con-
structors and destructors, virtual member functions, base class pointers, static and dynamic
binding, multiple inheritance, and class hierarchies.

Chapter 16: Exceptions, Templates, and the Standard


Template Library (STL)
The student learns to develop enhanced error trapping techniques using exceptions. Discus-
sion then turns to function and class templates as a method for reusing code. Finally, the
student is introduced to the containers, iterators, and algorithms offered by the Standard
Template Library (STL).

Chapter 17: Linked Lists


This chapter introduces concepts and techniques needed to work with lists. A linked list
ADT is developed and the student is taught to code operations such as creating a linked list,
appending a node, traversing the list, searching for a node, inserting a node, deleting a node,
and destroying a list. A linked list class template is also demonstrated.

Chapter 18: Stacks and Queues


In this chapter the student learns to create and use static and dynamic stacks and queues. The
operations of stacks and queues are defined, and templates for each ADT are demonstrated.

Chapter 19: Recursion


This chapter discusses recursion and its use in problem solving. A visual trace of recursive
calls is provided, and recursive applications are discussed. Many recursive algorithms are
presented, including recursive functions for finding factorials, finding a greatest common
Preface xxi

denominator (GCD), performing a binary search, and sorting (QuickSort). The classic Tow-
ers of Hanoi example is also presented. For students who need more challenge, there is a
section on exhaustive algorithms.

Chapter 20: Binary Trees


This chapter covers the binary tree ADT and demonstrates many binary tree operations. The
student learns to traverse a tree, insert an element, delete an element, replace an element, test
for an element, and destroy a tree.

Appendix A: Getting Started with Alice


This appendix gives a quick introduction to Alice. Alice is free software that can be used to
teach fundamental programming concepts using 3D graphics.

Appendix B: ASCII Character Set


A list of the ASCII and Extended ASCII characters and their codes.

Appendix C: Operator Precedence and Associativity


A chart showing the C++ operators and their precedence.

The following appendices are available online at www.pearsonhighered.com/gaddis.

Appendix D: Introduction to Flowcharting


A brief introduction to flowcharting. This tutorial discusses sequence, selection, case, repeti-
tion, and module structures.

Appendix E: Using UML in Class Design


This appendix shows the student how to use the Unified Modeling Language to design
classes. Notation for showing access specification, data types, parameters, return values,
overloaded functions, composition, and inheritance are included.

Appendix F: Namespaces
This appendix explains namespaces and their purpose. Examples showing how to define a
namespace and access its members are given.

Appendix G: Passing Command Line Arguments


Teaches the student how to write a C++ program that accepts arguments from the command
line. This appendix will be useful to students working in a command line environment, such
as Unix, Linux, or the Windows command prompt.

Appendix H: Header File and Library Function Reference


This appendix provides a reference for the C++ library functions and header files discussed
in the book.

Appendix I: Binary Numbers and Bitwise Operations


A guide to the C++ bitwise operators, as well as a tutorial on the internal storage of integers.
xxii Preface

Appendix J: Multi-Source File Programs


Provides a tutorial on creating programs that consist of multiple source files. Function
header files, class specification files, and class implementation files are discussed.

Appendix K: Stream Member Functions for Formatting


Covers stream member functions for formatting such as setf.

Appendix L: Answers to Checkpoints


Students may test their own progress by comparing their answers to the checkpoint exer-
cises against this appendix. The answers to all Checkpoints are included.

Appendix M: Solutions to Odd-Numbered Review Questions


Another tool that students can use to gauge their progress.

Features of the Text


Concept Each major section of the text starts with a concept statement.
Statements This statement summarizes the ideas of the section.
Example Programs The text has hundreds of complete example programs, each
designed to highlight the topic currently being studied. In most
cases, these are practical, real-world examples. Source code for
these programs is provided so that students can run the programs
themselves.
Program Output After each example program there is a sample of its screen
output. This immediately shows the student how the program
should function.
In the Spotlight Each of these sections provides a programming problem and a
detailed, step-by-step analysis showing the student how to
solve it.
VideoNotes A series of online videos, developed specifically for this book, is
available for viewing at www.pearsonhighered.com/gaddis.
Icons appear throughout the text alerting the student to videos
about specific topics.
Checkpoints Checkpoints are questions placed throughout each chapter as
a self-test study aid. Answers for all Checkpoint questions can
be downloaded from the book’s Companion Web site at www.
pearsonhighered.com/gaddis. This allows students to check how
well they have learned a new topic.
Notes Notes appear at appropriate places throughout the text. They are
short explanations of interesting or often misunderstood points
relevant to the topic at hand.
Preface xxiii

Warnings Warnings are notes that caution the student about certain C++
features, programming techniques, or practices that can lead to
malfunctioning programs or lost data.
Case Studies Case studies that simulate real-world applications appear in
many chapters throughout the text. These case studies are de-
signed to highlight the major topics of the chapter in which they
appear.
Review Questions Each chapter presents a thorough and diverse set of review
and Exercises questions, such as fill-in-the-blank and short answer, that check
the student’s mastery of the basic material presented in the chap-
ter. These are followed by exercises requiring problem solving
and analysis, such as the Algorithm Workbench, Predict the Out-
put, and Find the Errors sections. Answers to the odd-numbered
review questions and review exercises can be downloaded from
the book’s Companion Web site at www.pearsonhighered.com/
gaddis.
Programming Each chapter offers a pool of programming exercises designed
Challenges to solidify the student’s knowledge of the topics currently being
studied. In most cases the assignments present real-world prob-
lems to be solved. When applicable, these exercises include input
validation rules.
Group Projects There are several group programming projects throughout the
text, intended to be constructed by a team of students. One
student might build the program’s user interface, while another
student writes the mathematical code, and another designs and
implements a class the program uses. This process is similar to
the way many professional programs are written and encourages
team work within the classroom.
Software Available for download from the book’s Companion Web site at
Development www.pearsonhighered.com/gaddis. This is an ongoing project
Project: that instructors can optionally assign to teams of students. It
Serendipity systematically develops a “real-world” software package: a
Booksellers point-of-sale program for the fictitious Serendipity Booksellers
organization. The Serendipity assignment for each chapter adds
more functionality to the software, using constructs and tech-
niques covered in that chapter. When complete, the program will
act as a cash register, manage an inventory database, and produce
a variety of reports.
C++ Quick For easy access, a quick reference guide to the C++ language is
Reference Guide printed on the last two pages of Appendix C in the book.

11 C++11 Throughout the text, new C++11 language features are


introduced. Look for the C++11 icon to find these new features.
xxiv Preface

Supplements
Student Online Resources
Many student resources are available for this book from the publisher. The following items
are available on the Gaddis Series Companion Web site at www.pearsonhighered.com/gaddis:
● The source code for each example program in the book
● Access to the book’s companion VideoNotes
● A full set of appendices, including answers to the Checkpoint questions and answers
to the odd-numbered review questions
● A collection of valuable Case Studies
● The complete Serendipity Booksellers Project

Integrated Development Environment (IDE) Resource Kits


Professors who adopt this text can order it for students with a kit containing five popular
C++ IDEs (Microsoft® Visual Studio Express Edition, Dev C++, NetBeans, Eclipse, and
CodeLite) and access to a Web site containing written and video tutorials for getting started
in each IDE. For ordering information, please contact your campus Pearson Education rep-
resentative or visit www.pearsonhighered.com/cs.

Online Practice and Assessment with MyProgrammingLab


MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of pro-
gramming. Through practice exercises and immediate, personalized feedback, MyProgram-
mingLab improves the programming competence of beginning students who often struggle
with the basic concepts and paradigms of popular high-level programming languages.
A self-study and homework tool, a MyProgrammingLab course consists of hundreds of
small practice exercises organized around the structure of this textbook. For students, the
system automatically detects errors in the logic and syntax of their code submissions and
offers targeted hints that enable students to figure out what went wrong—and why. For
instructors, a comprehensive gradebook tracks correct and incorrect answers and stores the
code inputted by students for review.
MyProgrammingLab is offered to users of this book in partnership with Turing’s Craft, the
makers of the CodeLab interactive programming exercise system. For a full demonstration,
to see feedback from instructors and students, or to get started using MyProgrammingLab
in your course, visit www.myprogramminglab.com.

Instructor Resources
The following supplements are available to qualified instructors only:
• Answers to all Review Questions in the text
• Solutions for all Programming Challenges in the text
• PowerPoint presentation slides for every chapter
• Computerized test bank
Another Random Scribd Document
with Unrelated Content
187 Pike, History of Crime in England, ii. 253. Blackstone,
Commentaries on the Laws of England, iv. 347, n. a.

188 Jusserand, English Wayfaring Life in the Middle Ages, p. 166.

189 Nordström, Bidrag till den svenska samhälls-författningens


historia, ii. 405.

190 Du Boys, Histoire du droit criminel des peuples modernes, ii.


246.

191 Idem, Histoire du droit criminel de l’Espagne, p. 227 sq.

192 Hellwig, op. cit. p. 52.

193 Harris, Highlands of Æthiopia, ii. 93.

194 Rüppell, Reise in Abyssinien, ii. 74, 81. von Heuglin, Reise
nach Abessinien, p. 213.

195 von Haxthausen, Transcaucasia, p. 160, n. *

The right of sanctuary has been ascribed to various causes.


Obviously erroneous is the suggestion that places of refuge were
established with a view to protecting unintentional offenders from
punishment or revenge.196 The restriction of the privilege of
sanctuary to cases of accidental injuries is not at all general, and
where it occurs it is undoubtedly an innovation due to moral or social
considerations. Very frequently this privilege has been attributed to a
desire to give time for the first heat of resentment to pass over
before the injured party could seek redress.197 But although I admit
that such a desire may have helped to preserve the right of asylum
where it has once come into existence, I do not believe that it could
account for the origin of this right. We should remember that the
privilege of sanctuary not only affords temporary protection to the
refugee, but in many cases altogether exempts him from
punishment or retaliation, and that shelter is given even to animals
which have fled to a sacred place. And, if the theory referred to were
correct, how could we explain the fact that the right of asylum is
particularly attached to sanctuaries?
196 Hegel, Grundlinien der Philosophie des Rechts, § 117, p.
108. Powell, ‘Outlines of Sociology,’ in Saturday Lectures, p. 82.

197 Meiners, Geschichte der Menschheit, p. 189. Nordström, op.


cit. ii. 401. Pardessus, Loi Salique, p. 656. Bulmerincq, op. cit. pp.
34, 47. Fuld, loc. cit. pp. 102, 118, 119, 294 sqq. Kohler,
Shakespeare vor dem Forum der Jurisprudenz, p. 185.
Quatremère, loc. cit. p. 314. Mr. Mallery (Israelite and Indian, p.
33 sq.), also, thinks that the original object of the right of
sanctuary was to restrict vengeance and maintain peace, and that
this right only subsequently appeared as a prerogative of religion.

It has been said that the right of sanctuary bears testimony to the
power of certain places to transmit their virtues to those who
entered them.198 But we have no evidence that the fugitive is
supposed to partake of the sanctity of the place which shelters him.
In Morocco persons who are permanently attached to mosques or
the shrines of saints are generally regarded as more or less holy, but
this is never the case with casual visitors or suppliants; hence it is
hardly for fear of the refugee that his pursuer refrains from laying
hands on him. Professor Robertson Smith has stated part of the
truth in saying that “the assertion of a man’s undoubted rights as
against a fugitive at the sanctuary is regarded as an encroachment
on its holiness.”199 There is an almost instinctive fear not only of
shedding blood,200 but of disturbing the peace in a holy place; and if
it is improper to commit any act of violence in the house of another
man,201 it is naturally considered equally offensive, and also infinitely
more dangerous, to do so in the homestead of a supernatural being.
In the Tonga Islands, for instance, “it is forbidden to quarrel or fight
upon consecrated ground.”202 But this is only one aspect of the
matter; another, equally important, still calls for an explanation. Why
should the gods or saints themselves be so anxious to protect
criminals who have sought refuge in their sanctuaries? Why do they
not deliver them up to justice through their earthly representatives?
198 Granger, Worship of the Romans, p. 223 sq.

199 Robertson Smith, Religion of the Semites, p. 148.


200 Supra, i. 380.

201 Among the Barea and Kunáma in Eastern Africa a murderer


who finds time to flee into another person’s house cannot be
seized, and it is considered a point of honour for the community
to help him to escape abroad (Munzinger, Ostafrikanische Studien,
p. 503). In the Pelew Islands “no enemy may be killed in a house,
especially in the presence of the host” (Kubary, ‘Die Palau-Inseln
in der Südsee,’ in Jour. d. Museum Godeffroy, iv. 25). In Europe
the privilege of asylum went hand in hand with the sanctity of the
homestead (Wilda, op. cit. pp. 242, 243, 538, 543; Nordström,
op. cit. ii. 435; Fuld, loc. cit. p. 152; Frauenstädt, op. cit. p. 63
sqq.); and the breach of a man’s peace was proportionate to his
rank. Whilst every man was entitled to peace in his own house,
the great man’s peace was of more importance than the common
man’s, the king’s peace of more importance than the baron’s, and
in the spiritual order the peace of the Church commanded yet
greater reverence (Pollock, ‘The King’s Peace,’ in Law Quarterly
Review, i. 40 sq.).

202 Mariner, Natives of the Tonga Islands, ii. 232. Cf. ibid. i. 227.

The answer lies in certain ideas which refer to human as well as


divine protectors of refugees. The god or saint is in exactly the same
position as a man to whose house a person has fled for shelter.
Among various peoples the domicile of the chief or king is an asylum
for criminals;203 nobody dares to attack a man who is sheltered by
so mighty a personage, and from what has been said above, in
connection with the rules of hospitality, it is also evident why the
chief or king feels himself compelled to protect him. By being in
close contact with his host, the suppliant is able to transfer to him a
dangerous curse. Sometimes a criminal can in a similar way be a
danger to the king even from a distance, or by meeting him, and
must in consequence be pardoned. In Madagascar an offender
escaped punishment if he could obtain sight of the sovereign,
whether before or after conviction; hence criminals at work on the
highroad were ordered to withdraw when the sovereign was known
to be coming by.204 Among the Bambaras “une fois la sentence
prononcée, si le condamné parvient à cracher sur un prince, non-
seulement sa personne est sacrée, mais elle est nourrie, logée, etc.,
par le grand seigneur qui a eu l’imprudence de se tenir à portée de
cet étrange projectile.”205 In Usambara even a murderer is safe as
soon as he has touched the person of the king.206 Among the
Marutse and neighbouring tribes a person who is accused of any
crime receives pardon if he lays a cupa—the fossilised base of a
conical shell, which is the most highly valued of all their instruments
—at the feet of his chief; and a miscreant likewise escapes
punishment if he reaches and throws himself on the king’s drums.207
On the Slave Coast “criminals who are doomed to death are always
gagged, because if a man should speak to the king he must be
pardoned.”208 In Ashantee, if an offender should succeed in
swearing on the king’s life, he must be pardoned, because such an
oath is believed to involve danger to the king; hence knives are
driven through the cheeks from opposite sides, over the tongue, to
prevent him from speaking.209 So also among the Romans,
according to an old Jewish writer, a person condemned to death was
gagged to prevent him from cursing the king.210 Fear of the curses
pronounced by a dissatisfied refugee likewise, in all probability,
underlay certain other customs which prevailed in Rome. A servant
or slave who came and fell down at the feet of Jupiter’s high-priest,
taking hold of his knees, was for that day freed from the whip; and if
a prisoner with irons and bolts at his feet succeeded in approaching
the high-priest in his house, he was let loose and his fetters were
thrown into the road, not through the door, but from the roof.211
Moreover, if a criminal who had been sentenced to death accidentally
met a Vestal virgin on his way to the place of execution, his life was
saved.212 So sensitive to imprecations were both Jupiter’s high-priest
and the priestesses of Vesta, that the Praetor was never allowed to
compel them to take an oath.213 Now, as a refugee may by his curse
force a king or a priest or any other man with whom he establishes
some kind of contact to protect him, so he may in a similar manner
constrain a god or saint as soon as he has entered his sanctuary.
According to the Moorish expression he is then in the ʿâr of the
saint, and the saint is bound to protect him, just as a host is bound
to protect his guest. It is not only men that have to fear the curses
of dissatisfied refugees. Let us once more remember the words
which Aeschylus puts into the mouth of Apollo, when he declares his
intention to assist his suppliant, Orestes:—“Terrible both among men
and gods is the wrath of a refugee, when one abandons him with
intent.”214
203 Harmon, Voyages and Travels in the Interior of North
America, p. 297 (Tacullies). Lewin, Hill Tracts of Chittagong, p.
100 (Kukis). Junghuhn, Die Battaländer auf Sumatra, (Macassars
and Bugis of Celebes). Tromp, ‘Uit de Salasila van Koetei,’ in
Bijdragen tot de taal- land- en volkenkunde van Nederlandsch-
Indië, xxxvii. 84 (natives of Koetei, a district of Borneo). Jung,
quoted by Kohler, ‘Recht der Marschallinsulaner,’ in Zeitschr. f.
vergl. Rechtswiss. xiv. 447 (natives of Nauru in the Marshall
Group). Turner, Nineteen Years in Polynesia, p. 334 (Samoans).
Rautanen, in Steinmetz, Rechtsverhältnisse, p. 342 (Ondonga).
Schinz, op. cit. p. 312 (Ovambo). Rehme, ‘Das Recht der
Amaxosa,’ in Zeitschr. f. vergl. Rechtswiss. x. 50. Merker, quoted
by Kohler, ‘Banturecht in Ostafrika,’ ibid. xv. 55 (Wadshagga).
Merker, Die Masai, p. 206. Among the Barotse the residences of
the Queen and the Prime Minister are places of refuge (Decle, op.
cit. p. 75).

204 Ellis, History of Madagascar, i. 376.

205 Raffenel, Nouveau voyage dans le pays des nègres, i. 385.

206 Krapf, Reisen in Ost-Afrika, ii. 132, n. * See also Schinz, op.
cit. p. 312 (Ovambo).

207 Gibbons, Exploration in Central Africa, p. 129. I am indebted


to Mr. N. W. Thomas for drawing my attention to this statement.

208 Ellis, Ew̔ e-speaking Peoples of the Slave Coast, p. 224.

209 Ibid. p. 224.

210 Quoted by Levias, ‘Cursing,’ in Jewish Encyclopedia, iv. 390.


211 Plutarch, Questiones Romanæ, 111. Aulus Gellius, Noctes
Atticæ, x. 15. 8, 10.

212 Plutarch, Numa, x. 5.

213 Aulus Gellius, op. cit. x. 15. 31.

214 Aeschylus, Eumenides, 232 sqq.


CHAPTER XLIX
DUTIES TO GODS (concluded)

SUPERNATURAL beings are widely believed to have a feeling of their


worth and dignity. They are sensitive to insults and disrespect, they
demand submissiveness and homage.
”The gods of the Gold Coast,” says Major Ellis, “are jealous gods,
jealous of their dignity, jealous of the adulation and offerings paid to
them; and there is nothing they resent so much as any slight,
whether intentional or accidental, which may be offered them….
There is nothing that offends them so deeply as to ignore them, or
question their power, or laugh at them.”1 The wrath of Yahveh burst
forth with vehemence whenever his honour or sanctity was in the
least violated, however unintentionally.2 Many peoples consider it
insulting and dangerous merely to point at one of the celestial
bodies;3 and among the North American Indians it is a widespread
belief that, if anybody points at the rainbow, the finger will wither or
become misshapen.4
1 Ellis, Tshi-speaking Peoples of the Gold Coast, p. 11.

2 Cf. Montefiore, Hibbert Lectures on the Religion of the Ancient


Hebrews, pp. 38, 102.

3 Liebrecht, Zur Volkskunde, p. 341, Dorman, Origin of Primitive


Superstitions, p. 344 (Chippewas). Wuttke, Der deutsche
Volksaberglaube der Gegenwart, § 11, p. 13 sq.

4 Mooney, ‘Myths of the Cherokee,’ in Ann. Rep. Bur. Ethn. xix.


257, 442.

Nor is it to supernatural danger only that a person exposes himself


by irreverence to a god, but in many cases he is also punished by his
fellow men. On the Slave Coast insults to a god “are always resented
and punished by the priests and worshippers of that god, it being
their duty to guard his honour.”5 Among the ancient Peruvians6 and
Hebrews,7 as also among Christian nations up to comparatively
recent times, blasphemy was a capital offence. In England, in the
reign of Henry VIII., a boy of fifteen was burned because he had
spoken, much after the fashion of a parrot, some idle words
affecting the sacrament of the altar, which he had chanced to hear
but of which he could not have understood the meaning.8 According
to Muhammedan law a person guilty of blasphemy is to be put to
death without delay, even though he profess himself repentant, as
adequate repentance for such a sin is deemed impossible.9 These
and similar laws are rooted in the idea that the god is personally
offended by the insult. It was the Lord himself who made the law
that he who blasphemed His name should be stoned to death by all
the congregation.10 “Blasphemy,” says Thomas Aquinas, “as being an
offence directly against God, outweighs murder, which is an offence
against our neighbour…. The blasphemer intends to wound the
honour of God.”11 That blasphemy is, or should be, punished not as
a sin against the deity but as an offence against the religious
feelings of men, is an idea of quite modern origin.
5 Ellis, Ew̔ e-speaking Peoples of the Slave Coast, p. 81.

6 Prescott, History of the Conquest of Peru, i. 42.

7 Leviticus, xxiv. 14 sqq.

8 Pike, History of Crime in England, ii. 56.

9 Lane, Manners and Customs of the Modern Egyptians, p. 123.

10 Leviticus, xxiv. 16.

11 Thomas Aquinas, Summa theologica, ii.-ii. 13. 3. 1.

In many cases it is considered offensive to a supernatural being


merely to mention his name. Sometimes the name is tabooed on
certain occasions only or in ordinary conversation, sometimes it is
not to be pronounced at all.
In Morocco the jnûn (jinn) must not be referred to by name in the
afternoon and evening after the ʿâṣar. If speaking of them at all, the
people then make use of some circumlocution; the Berbers of
Southern Morocco call them wīd-iáḍnin, “those others,” or wīd-urḍ-
hĕr’nin, “those unseen,” or wīd-tntl-tísnt, “those who shun salt.” The
Greenlanders dare not pronounce the name of a glacier as they row
past it, for fear lest it should be offended and throw off an iceberg.12
Some North American Indians believe that if, when travelling, they
mention the names of rocks or islands or rivers, they will have much
rain or be wrecked or be devoured by some monster in the river.13
The Omahas, again, “are very careful not to use names which they
regard as sacred on ordinary occasions; and no one dares to sing
sacred songs except the chiefs and old men at the proper times.”14
Some other Indians considered it a profanation to mention the name
of their highest divinity.15 Among certain Australian natives the
elders of the tribe impart to the youth, on his initiation, the name of
the god Tharamūlŭn; but there is such a disinclination to pronounce
his name that, in speaking of him, they generally use elliptical
expressions, such as “He,” “the man,” or “the name I told you of,”
and the women only know him by the name of Papang (father).16
The Marutse and allied tribes along the Zambesi shrink from
mentioning the real name of their chief god Nyambe and therefore
substitute for it the word molemo, which has a very comprehensive
meaning, denoting, besides God, all kinds of good and evil spirits,
medicines, poisons, and amulets.17 According to Cicero, there was a
god, a son of Nilus, whose name the Egyptians considered it a crime
to pronounce;18 and Herodotus is unwilling to mention the name of
Osiris on two occasions when he is speaking of him.19 The divine
name of Indra was secret, the real name of Agni was unknown.20
The gods of Brahmanism have mystic names, which nobody dares to
speak.21 The real name of Confucius is so sacred that it is a
statutable offence in China to pronounce it; and the name of the
supreme god of the Chinese is equally tabooed. “Tien,” they say,
“means properly only the material heaven, but it also means Shang-
Te (supreme ruler, God); for, as it is not lawful to use his name
lightly, we name him by his residence, which is in tien.”22 The “great
name” of Allah is a secret name, known only to prophets, and
possibly to some great saints.23 Yahveh said, “Thou shalt not take
the name of the Lord thy God in vain; for the Lord will not hold him
guiltless that taketh his name in vain”;24 and orthodox Jews avoid
mentioning the word Yahveh altogether.25 Among Christian nations,
as Professor Nyrop observes, there is a common disinclination to use
the word “God” or its equivalents in everyday speech. The English
say good instead of God (“good gracious,” “my goodness,” “thank
goodness”); the Germans, Potz instead of Gotts (“Potz Welt,” “Potz
Wetter,” “Potz Blitz”); the French, bleu instead of Dieu (“corbleu,”
“morbleu,” “sambleu”); the Spaniards, brios or diez instead of Dios
(“voto á brios,” “juro á brios,” “par diez”).26
12 Nansen, Eskimo Life, p. 233.

13 Nyrop, ‘Navnets magt,’ in Mindre Afhandlinger udgivne af det


philologisk-historiske Samfund, 1887, p. 28.

14 Dorsey, ‘Omaha Sociology,’ in Ann. Rep. Bur. Ethn. iii. 370.

15 Adair, History of the American Indians, p. 54.

16 Howitt, ‘Some Australian Beliefs,’ in Jour. Anthr. Inst. xiii. 192.


See also Idem, Native Tribes of South-East Australia, pp. 489,
495.

17 Holub, Seven Years in South Africa, ii. 301.

18 Cicero, De natura deorum, iii. 22 (56).

19 Herodotus, ii. 132, 171.

20 Hopkins, Religions of India, pp. 93, 111.

21 Ibid. p. 184.

22 Friend, ‘Euphemism and Tabu in China,’ in Folk-Lore Record,


iv. 76. Cf. Edkins, Religion in China, p. 72.

23 Sell, Faith of Islám, p. 185. Lane, Modern Egyptians, p. 273.

24 Exodus, xx. 7.
25 Herzog-Plitt, Real-Encyklopädie für protestantische Theologie,
vi. 501 sq.

26 Nyrop, loc. cit. p. 155 sqq.

These taboos have sprung from fear. There is, first, something
uncanny in mentioning the name of a supernatural being, even apart
from any definite ideas connected with the act. But to do so is also
supposed to summon him or to attract his attention, and this may be
considered dangerous, especially if he is looked upon as malevolent
or irritable, as is generally the case with the Moorish jnûn. The
uncanny feeling or the notion of danger readily leads to the belief
that the supernatural being feels offended if his name is
pronounced; we have noticed a similar association of thought in
connection with the names of the dead. But a god may also have
good reason for wishing that his name should not be used lightly or
taken in vain. According to primitive ideas a person’s name is a part
of his personality, hence the holiness of a god may be polluted by his
name being mentioned in profane conversation. Moreover, it may be
of great importance for him to prevent his name from being
divulged, as magic may be wrought on a person through his name
just as easily as through any part of his body. In early civilisation
there is a common tendency to keep the real name of a human
individual secret so that sorcerers may not make an evil use of it;27
and it is similarly believed that gods must conceal their true names
lest other gods or men should be able to conjure with them.28 The
great Egyptian god Râ declared that the name which his father and
mother had given him remained hidden in his body since his birth,
so that no magician might have magic power over him.29 The list of
divine names possessed by the Roman pontiffs in their indigitamenta
was a magical instrument which laid at their mercy all the forces of
the spirit world;30 and we are told that the Romans kept the name of
their tutelary god secret in order to prevent their enemies from
drawing him away by pronouncing it.31 There is a Muhammedan
tradition that whosoever calls upon Allah by his “great name” will
obtain all his desires, being able merely by mentioning it to raise the
dead to life, to kill the living, in fact to perform any miracle he
pleases.32
27 Tylor, Early History of Mankind, p. 139 sqq. Andree,
Ethnographische Parallelen, p. 179 sqq. Frazer, Golden Bough, i.
403 sqq. Clodd, Tom Tit Tot, pp. 53–55, 81 sqq. Haddon, Magic
and Fetishism, p. 22 sq.

28 Tylor, op. cit. p. 124 sq. Frazer, op. cit. i. 443. Clodd, op. cit.
p. 173. Haddon, op. cit. p. 23 sqq.

29 Frazer, op. cit. i. 444.

30 Granger, Worship of the Romans, pp. 212, 277. Cf. Jevons, in


Plutarch’s Romane Questions, p. lvii.

31 Plutarch, Questiones Romanæ, 61. Pliny, Historia naturalis,


xxviii. 4. Macrobius, Saturnalia, iii. 9.

32 Sell, op. cit. p. 185. Lane, Modern Egyptians, p. 273.

One of the greatest insults which can be offered a god is to deny


his existence. Plutarch was astonished at people’s saying that
atheism is impiety, while at the same time they attribute to gods all
kinds of less creditable qualities. “I for my part,” he adds, “would
much rather have men to say of me that there never was a Plutarch,
at all, nor is now, than to say that Plutarch is a man inconstant,
fickle, easily moved to anger, revengeful for trifling provocations,
vexed at small things.”33 But Plutarch seems to have forgotten that a
person is always most sensitive on his weak points, and that the
weakest point in a god is his existence. Religious intolerance is in a
large measure the result of that feeling of uncertainty which can
hardly be eradicated even by the strongest will to believe. It is a
means of self-persuasion in a case where such persuasion is sorely
needed. Moreover, a god who is not believed to exist can be no
object of worship, and to be worshipped is commonly held to be the
chief ambition of a god. But atheism is a sin of civilisation.
Uncultured people are ready to believe that all supernatural beings
they hear of also exist.
33 Plutarch, De superstitione, 10.

Some gods are extremely ungenerous towards all those who do


not recognise them, and only them, as their gods. To believe in
Ahura Mazda was the first duty which Zoroastrianism required of a
man; it was Angra Mainyu, the evil spirit, that had countercreated
the sin of unbelief.34 Doubt destroyed even the effects of good
actions;35 indeed, only the true believer was to be regarded as a
man.36 The faithful were summoned to a war to the death against
the opposing spirits, the Daevas, and their followers.37 And to judge
from ancient writers, the Persians, when they came into contact with
nations of another religion, also carried into practice the intolerant
spirit of their own.38 Yahveh said:—“Thou shalt have no other gods
before me…. Thou shalt not bow down thyself to them, nor serve
them: for I the Lord thy God am a jealous God.”39 In the pre-
prophetic period the existence of other gods was recognised,40 but
they were not to be worshipped by Yahveh’s people. Nor was any
mercy to be shown to their followers, for Yahveh was “a man of
war.”41 The God of Christianity inherited his jealousy. In the name of
Christ wars were waged, not, it is true, for the purpose of
exterminating unbelievers, but with a view to converting them to a
faith which alone could save their souls from eternal perdition. So far
as the aim of the persecution is concerned we can thus notice a
distinct progress in humanity. But whilst the punishment which
Yahveh inflicted upon the devotees of other gods was merely
temporal and restricted to a comparatively small number of people—
he took notice of such foreign nations only which came within his
sphere of interests,—Christianity was a proselytising religion on a
large scale, anxious to save but equally ready to condemn to
everlasting torments all those who refused to accept it, nay even the
milliards of men who had never heard of it. In this point Christianity
was even more intolerant than the Koran itself, which does not
absolutely confine salvation to the believers in Allah and his Prophet,
but leaves some hope of it to Jews, Christians, and Sabæans,
though all other infidels are hopelessly lost.42
34 Vendîdâd, i. 8. 16.

35 Darmesteter, Ormazd et Ahriman, p. 330, n. 4.

36 Dînâ-î Maînôg-î Khirad, xlii. 6 sqq.

37 See Darmesteter, in Sacred Books of the East, iv. p. lii.;


Spiegel, Erânische Alterthumskunde, iii. 692.

38 Spiegel, op. cit. iii. 708.

39 Exodus, xx. 3, 5.

40 Kuenen, Hibbert Lectures on National Religions and Universal


Religions, p. 119. Baudissin, Studien zur semitischen
Religionsgeschichte, i. 49 sqq.

41 Exodus, xv. 3.

42 Koran, v. 73.

That Muhammedanism has in course of time become the most


fanatical of existing religions is due to political rather than religious
causes. For a thousand years the Christian and Muhammedan world
were engaged in a deadly contest, in which the former came off
victorious. Most nations confessing Islam have either lost their
independence or are on the verge of losing it. The memory of past
defeats and cruelties, the present state of subjection or national
weakness, the fear of the future—are all factors which must be
taken into account when we judge of Moslem fanaticism. In its
younger days Islam was undoubtedly, not only in theory but in
practice, less intolerant than its great rival, Christian subjects of
Muhammedan rulers being on the whole treated with
consideration.43 Earlier travellers in Arabia also speak favourably of
the tolerance of its inhabitants. Niebuhr was able to write:—“I never
saw that the Arabs have any hatred for those of a different religion.
They, however, regard them with much the same contempt with
which Christians look upon the Jews in Europe…. The Mahometans
in India appear to be even more tolerant than those of Arabia…. The
Mussulmans in general do not persecute men of other religions,
when they have nothing to fear from them, unless in the case of an
intercourse of gallantry with a Mahometan woman.”44 In China the
Muhammedans live amicably with the infidel, regarding their
Buddhist neighbours “with a kindly feeling which it would be hard to
find in a mixed community of Catholics and Evangelicals.”45
Muhammedanism looks upon the founder of Christianity with
profound reverence, as one of the apostles of God, as the only man
without sin. Christian writers, on the other hand, till the middle of
the eighteenth century universally treated Muhammed as a false
prophet and rank impostor. Luther called him “a devil, and a first-
born child of Satan,” whilst Melanchthon was inclined to see in him
both Gog and Magog.46
43 See von Kremer, Culturgeschichte des Orients, ii. 166 sq.

44 Niebuhr, Travels through Arabia, ii. 192, 189 sq. Cf. d’Arvieux,
Travels in Arabia the Desart, p. 123; Wallin, Notes taken during a
Journey through Northern Arabia, p. 21.

45 Lane-Poole, Studies in a Mosque, p. 298 sq.

46 [Deutsch,] ‘Islam,’ in Quarterly Review, cxxvii. 295 sq.


Bosworth Smith, Mohammed and Mohammedanism, pp. 67, 69.
Pool, Studies in Mohammedanism, p. 406.

Equal in enormity with the sin of not believing in a certain god is


sometimes the sin of having a false belief about him. It seems
strange that a god should be so easily offended as to punish with
the utmost severity those who hold erroneous notions regarding
some attribute of his which in no way affects his honour or glory, or
regarding some detail of ritual. Thomas Aquinas himself admits that
the heretic intends to take the word of Christ, although he fails “in
the election of articles whereon to take that word.” But it is in this
election that his sin consists. Instead of choosing those articles
which are truly taught by Christ, he chooses those which his own
mind suggests to him. Thus he perverts the doctrines of Christ, and
in consequence deserves not only to be separated from the Church
by excommunication, but to be banished from the world by death.47
Moreover, the heretic is an apostate, a traitor who may be forced to
pay the vow which he has once taken.48 The extreme rigour of this
sophistical argumentation can only be understood in connection with
its historical surroundings. It presupposes a Church which not only
regards itself as the sole possessor of divine truth, but whose
cohesion and power depend upon a strict adherence to its
doctrines.49 Nor was it a religious motive only that induced Christian
sovereigns to persecute heretics. Certain heresies, as Manichæism
and Donatism, were expressly declared to affect the common
welfare;50 and the Frankish kings treated heretics not only as rebels
against the Church, but as traitors to the State, as confederates of
hostile Visigoths or Burgundians or Lombards.51
47 Thomas Aquinas, op. cit. ii.-ii. 11. 1, 3.

48 Ibid. ii.-ii. 10. 8.

49 Cf. Ritchie, Natural Rights, p. 183.

50 Milman, History of Latin Christianity, ii. 33.

51 Ibid. ii. 61.

Whilst intolerance is a characteristic of all monotheistic religions


which attribute human passions and emotions to their godhead,
polytheism is by nature tolerant. A god who is always used to share
with other gods the worship of his believers cannot be a very jealous
god. The pious Hennepin was struck by the fact that Red Indians
were “incapable of taking away any person’s life out of hatred to his
religion.”52 Among the natives of the African Gold and Slave Coasts,
though a man must show outward respect for the gods so as not to
provoke calamities, he may worship many gods or none, just as he
pleases. “There is perfect liberty of thought in matters of religion….
At this stage, man tolerates any form of religion that tolerates
others; and as he thinks it perfectly natural that different people
should worship different gods, he does not attempt to force his own
personal opinions upon anyone, or to establish conformity of
ideas.”53 On the Slave Coast even a sacrilege committed by a
European is usually regarded with indifference, as the gods of a
country are supposed to be concerned about the actions of the
people of that country only.54 “The characteristics of Natural
Religion,” says Sir Alfred Lyall, “the conditions of its existence as we
see it in India, are complete liberty and material tolerance; there is
no monopoly either of divine powers or even of sacerdotal
privilege.”55 In China the hatred of foreigners has not its root in
religion. The Catholics residing there were left undisturbed until they
began to meddle with the civil and social institutions of the
country;56 and the difficulty in persuading the Chinese to embrace
Christianity is said by a missionary to be due to their notion that one
religion is as good as another provided that it has a good moral
code.57 Among the early Greeks and Romans it was a principle that
the religion of the State should be the religion of the people, as its
welfare was supposed to depend upon a strict observance of the
established cult; but the gods cared for external worship rather than
for the beliefs of their worshippers, and evidently took little notice
even of expressed opinions. Philosophers openly despised the very
rites which they both defended and practised; and religion was more
a pretext than a real motive for the persecutions of men like
Anaxagoras, Protagoras, Socrates, and Aristotle.58 So also the
measures by which the Romans in earlier times repressed the
introduction of new religions were largely suggested by worldly
considerations; “they grew out of that intense national spirit which
sacrificed every other interest to the State, and resisted every form
of innovation, whether secular or religious, that could impair the
unity of the national type, and dissolve the discipline which the
predominance of the military spirit and the stern government of the
Republic had formed.”59 It has also been sufficiently proved that the
persecutions of the Christians during the pagan Empire sprang from
motives quite different from religious intolerance. Liberty of worship
was a general principle of the Imperial rule. That it was denied the
Christians was due to their own aggressiveness, as also to political
suspicion. They grossly insulted the pagan cult, denouncing it as the
worship of demons, and every calamity which fell upon the Empire
was in consequence regarded by the populace as the righteous
vengeance of the offended gods. Their proselytism disturbed the
peace of families and towns. Their secret meetings aroused
suspicion of political danger; and this suspicion was increased by the
doctrines they professed. They considered the Roman Empire a
manifestation of Antichrist, they looked forward with longing to its
destruction, and many of them refused to take part in its defence.
The greatest and best among the pagans spoke of the Christians as
“enemies,” or “haters of the human race.”60
52 Hennepin, New Discovery of a Vast Country in America, ii. 70.

53 Ellis, Yoruba-speaking Peoples of the Slave Coast, p. 295. See


also Idem, Ew̔ e-speaking Peoples of the Slave Coast, p. 81;
Monrad, Skildring af Guinea-Kysten, p. 28; Kubary, ‘Die
Verbrechen und das Strafverfahren auf den Pelau-Inseln,’ in
Original-Mittheil. aus d. ethnol. Abtheil. d. königl. Museen zu
Berlin, i. 90.

54 Ellis, Ew̔ e-speaking Peoples, p. 81.

55 Lyall, Natural Religion in India, p. 52.

56 Davis, China, ii. 7. Cf. Edkins, op. cit. p. 178.

57 Edkins, op. cit. p. 75.

58 See Schmidt, Die Ethik der alten Griechen, ii. 24 sqq.

59 Lecky, History of European Morals, i. 493. Cf. Dio Cassius,


Historia Romana, lii. 36.

60 Lecky, op. cit. i. 408 sqq. Ramsay, The Church in the Roman
Empire, p. 346 sqq. See also supra, i. 345 sq.; ii. 178 sq.

The same difference in toleration between monotheistic and


polytheistic religions shows itself in their different attitudes towards
witchcraft. A monotheistic religion is not necessarily averse from
magic; its god may be supposed to have created magical as well as
natural energy, and also to have given mankind permission to utilise
it in a proper manner. Both Christianity in its earlier phases and
Muhammedanism are full of magical practices expressly sanctioned
by their theology—for instance, the use made of sacred words and
of the relics of saints. But besides this sort of magic there is another
kind—witchcraft, in the narrow sense of the term,—which is ascribed
to the assistance of exorcised spirits, regarded not as the willing
agents but as the adversaries of God; and this practice is naturally
looked upon as highly offensive to His feelings. In Christianity
witchcraft was esteemed the most horrible form of impiety.61 The
religious law of the Hebrews—which generally prohibited all practices
that savoured of idolatry, such as soothsaying and oracles—punished
witches and wizards with death.62 Islam disapproves of all magic
which is practised with the assistance of evil spirits, or jinn, although
such magic is very prevalent and popularly tolerated in
Muhammedan countries.63 Among polytheistic peoples, again,
witchcraft is certainly in many cases treated with great severity; a
large number of uncivilised races punish it with death,64 and among
some of them it is the only offence which is capital.65 But then
witchcraft is punished because it is considered destructive to human
life or welfare.66 “In Africa,” says Mr. Rowley, “there is what is
regarded as lawful as well as unlawful witchcraft, the lawful being
practised professedly for the welfare of mankind, and in opposition
to the unlawful, which is resorted to for man’s injury.” But “the
purposes of witchcraft are now generally wicked; its processes
generally involve moral guilt; the spirits invoked are, for the most
part, avowedly evil and maleficent.”67 Among the Gaika tribe of the
Kafirs “witchcraft is supposed to be an influence for evil, possessed
by one individual over another, or others.”68 Among the Bondeis “the
meaning of witchcraft is simply murder.”69 That witchcraft, as a
malicious practice, must be a grave and at the same time frequent
offence among savages, is obvious from the common belief that
death, disease, and misfortunes of every description are caused by
it. From a similar point of view it is condemned by polytheistic
nations of a higher type. Among the Aztecs of ancient Mexico
anybody who employed sorcery or incantations for the purpose of
doing harm to the community or to individuals was sacrificed to the
gods.70 The Chinese Penal Code punishes with death those who
have been convicted of writing and editing books of sorcery, or of
employing spells and incantations, “in order to agitate and influence
the minds of the people.”71 But, according to Mr. Dennys, the hatred
of witches and wizards cherished in the West does not seem to exist
in China; “those reputed to possess magic powers are regarded with
dread, but it is rare to hear of any of them coming to untimely end
by mob violence.”72 The Laws of Ḫammurabi, the ancient Babylonian
legislator, enjoin that “if a man weave a spell and put a ban upon a
man, and has not justified himself, he that wove the spell upon him
shall be put to death.”73 It is said in ‘Vishnu Purâna’ that he who
practises magical rites “for the harm of others” is punished in the
hell called Krimîsa.74 Among the ancient Teutons not every kind of
magic but only such as was considered of injurious nature was
criminal.75 In Rome, also, what was deemed harmless magic was left
undisturbed, whereas, according to the ‘Law of the Twelve Tables,’
“he who affects another by magical arts or with poisonous drugs” is
to be put to death;76 and during the Empire persons were severely
persecuted for political astrology or divination practised with a view
to discovering the successors to the throne.77 Plato, writes in his
‘Laws’:—“He who seems to be the sort of man who injures others by
magic knots or enchantments or incantations or any of the like
practices, if he be a prophet or divine, let him die; and, if not being
a prophet, he be convicted of witchcraft, as in the previous case, let
the court fix what he ought to pay or suffer.”78 As Mr. Lecky justly
remarks, both in Greece and Rome the measures taken against
witchcraft seem to have been almost entirely free from religious
fanaticism, the magician being punished because he injured man
and not because he offended God.79 Sometimes we find even among
a polytheistic people that sorcery is particularly opposed by its
priesthood;80 but the reason for this is no doubt hatred of rivals
rather than religious zeal. Miss Kingsley, however, does not think that
the dislike of witchcraft in West Africa at large has originally anything
to do with the priesthood.81
61 Lea, History of the Inquisition, iii. 422, 453. Pollock and
Maitland, History of English Law before the Time of Edward I. ii.
552 sqq. Milman, op. cit. ix. 69. Lecky, Rise and Influence of
Rationalism in Europe, i. 26. Keary, Outlines of Primitive Belief
among the Indo-European Races, p. 511 sqq. Rogers, Social Life
in Scotland, iii. 265, 268. Ralston, Songs of the Russian People,
pp. 386, 416 sq.

62 Exodus, xxii. 18. Leviticus, xix. 26, 31; xx. 6, 27.


Deuteronomy, xviii. 10 sqq.

63 Polak, Persien, i. 348. Lane, Modern Egyptians, i. 333.

64 Supra, i. 189 sq. Cruickshank, Eighteen Years on the Gold


Coast, ii. 179. Bowdich, Mission to Ashantee, p. 260. Johnston,
British Central Africa, p. 403 (Bakongo). Cunningham, Uganda,
pp. 35 (Banyoro), 140 (Bavuma), 305 (Basukuma), Arnot,
Garenganze, p. 75. Decle, Three Years in Savage Africa, p. 76
(Barotse). Casalis, Basutos, p. 229. Kidd, The Essential Kafir, p.
148 sq. Sibree, The Great African Island, p. 292 (Malagasy).
Swettenham, Malay Sketches, p. 196 (Malays of Perak). Dalton,
Ethnology of Bengal, (Oraons). Egede, Description of Greenland,
p. 123 sq. Krause, Die Tlinkit-Indianer, p. 293 sq. Jones, quoted
by Kohler, ‘Die Rechte der Urvölker Nordamerikas,’ in Zeitschr. f.
vergl. Rechtswiss. xii. 412 (Chippewas). Morgan, League of the
Iroquois, p. 330; Seaver, Life of Mrs. Jemison, p. 167 (Iroquois).
Powell, ‘Wyandot Government,’ in Ann. Rep. Bur. Ethn. i. 67.
Stevenson, ‘Sia,’ ibid. xi. 19. Lumholtz, Unknown Mexico, i. 325
(Tarahumares). Forbes, ‘Aymara Indians of Bolivia and Peru,’ in
Jour. Ethn. Soc. N. S. ii. 236, n. *

65 Supra, i. 189.

66 Cf. Dorsey, ‘Omaha Sociology,’ in Ann. Rep. Bur. Ethn. iii. 364.

67 Rowley, Religion of the Africans, p. 125 sq. See also Kidd, The
Essential Kafir, p. 148.

68 Maclean, Compendium of Kafir Laws, p. 123.

69 Dale, in Jour. Anthr. Inst. xxv. 223.

70 Bancroft, Native Races of the Pacific States, ii. 462.


71 Ta Tsing Leu Lee, sec. cclvi. p. 273.

72 Dennys, Folk-Lore of China, p. 80.

73 Laws of Ḫammurabi, 1.

74 Vishńu Puráńa, p. 208.

75 Brunner, Deutsche Rechtsgeschichte, ii. 678.

76 Lex Duodecim Tabularum, viii. 25.

77 Lecky, History of European Morals, i. 420.

78 Plato, Leges, xi. 933.

79 Lecky, Rationalism in Europe, i. 18.

80 Kingsley, West African Studies, p. 137. Rink, Greenland, p.


201.

81 Kingsley, West African Studies, p. 135 sq.

The religious intolerance which has accompanied the rise of


monotheism is, as we have just observed, the result of the nature
attributed to its godhead. But the evolution of religion does not end
with the triumph of a jealous and irritable heavenly despot. There is
a later stage where men believe in a god or supernatural power
which is absolutely free from all human weakness, and in such a
religion intolerance has no place. It has been said that the tolerant
spirit of Buddhism82 is due to religious indifference,83 but the original
cause of it seems to be the absence of a personal god; and the
increasing tolerance of modern Christianity is undoubtedly connected
with the more ethical view it takes of the Deity when compared with
the opinions of earlier ages. It should be remembered, however, that
religious toleration does not mean passive indifference with regard
to dissenting religious ideas. The tolerant man may be a great
propagandist. He may do his utmost to eradicate, by means of
persuasion, what he considers to be a false belief. He may even
resort to stronger measures against those who do mischief in the
name of their religion. But he does not persecute anybody for the
sake of his faith; nor does he believe in an intolerant and
persecuting god.
82 Hardy, Eastern Monachism, p. 412. Monier-Williams,
Buddhism, p. 126. Waddell, Buddhism of Tibet, p. 568. Edkins,
Religion in China, p. 127. Gutzlaff, Sketch of Chinese History, i.
70. Forbes, British Burma, p. 322 sq.

83 Forbes, op. cit. p. 322. Cf. Kuenen, Hibbert Lectures on


National and Universal Religions, p. 290.

Supernatural beings, according to the belief of many races, desire


to be worshipped not only because they depend upon human care
for their subsistence or comfort, but because worship is an act of
homage. We have seen that sacrifice, after losing its original
significance, still survives as a reverent offering. So also prayer is
frequently a tribute to the self-regarding pride of the god to whom it
is addressed. A supplication is an act of humility, more or less
flattering to the person appealed to and especially gratifying where,
as in the case of a god, the granting of the request entails no
deprivation or loss, but on the contrary is rewarded by the
worshipper. Moreover, the request is very commonly accompanied by
reverential epithets or words of eulogy; and praise, nay even flattery,
is just as pleasant to superhuman as to human ears. Gods are
addressed as great or mighty, as lords or kings, as fathers or
grandfathers.84 A prayer of the ancient Peruvians began with the
following words:—“O conquering Viracocha! Ever present Viracocha!
Thou art in the ends of the earth without equal!”85 The ancient
Egyptians flattered their gods,86 the Vedic and Zoroastrian hymns
are full of praise. Muhammedans invoke Allah by sentences such as,
“God is great,” “God is merciful,” “God is he who seeth and heareth.”
Words of praise, as well as words of thanks, addressed to a god,
may certainly be the expressions of unreflecting admiration or
gratitude, free from all thought of pleasing him; but where laudation
is demanded by the god as a price for good services, it is simply a
tribute to his vanity. There is a Chinese story which amusingly
illustrates this little weakness of so many gods:—At the hottest
season of the year there was a heavy fall of snow at Soochow. The
people, in their consternation, went to the temple of the Great
Prince to pray. Then the spirit moved one of them to say, “You now
address me as Your Honour. Make it Your Excellency, and, though I
am but a lesser deity, it may be well worth your while to do so.”
Thereupon the people began to use the latter term, and the snow
stopped at once.87 The Hindus say that by praise a person may
obtain from the gods whatever he desires.88
84 See Brinton, Religions of Primitive Peoples, p. 105.

85 de Molina, ‘Fables and Rites of the Yncas,’ in Narratives of the


Rites and Laws of the Yncas, p. 33.

86 Amélineau, L’évolution des idées morales dans l’Égypte


ancienne, p. 214.

87 Giles, Strange Stories from a Chinese Studio, ii. 294.

88 Ward, View of the History, Literature, and Religion of the


Hindoos, ii. 69.

We have different means of gratifying a person’s self-regarding


pride: one is to praise him, another is to humiliate ourselves. Both
have been adopted by men with reference to their gods. Besides
hymns of praise there are hymns of penitence, the object of which is
largely to appease the angry feelings of offended gods. Prayers for
remission of sins form a whole literature among peoples like that of
the Vedic age, the Chaldeans,89 and the Hebrews, who commonly
regarded calamities to which men were subject not as the result of
an inexorable fate nor as the machinations of evil spirits, but as
divine punishments. According to early ideas, as we have seen, sin is
a substance charged with injurious energy, from which the infected
person tries to rid himself by mechanical means.90 But at the same
time the effect of sin is conceived as a divine punishment, and this
suggests atonement. In the Rig-Veda we not only hear of the
removal of sins by magical operations, but the gods are requested to
free the sufferer from his sin.91
89 Zimmern, Babylonische Busspsalmen, passim. Mürdter-
Delitzsch, Geschichte Babyloniens und Assyriens, p. 38 sq.
Delitzsch, Wo lag das Paradies? p. 86. Hommel, Die semitischen
Völker und Sprachen, p. 315 sqq. Meyer, Geschichte des
Alterthums, i. 178.

90 Supra, i. 52 sqq.

91 See Oldenberg, Die Religion des Veda, pp. 292, 296, 317 sq.

Gods are fond of prayers not only as expressions of humility or


repentance but for other reasons as well. In early religion a prayer is
commonly connected with an offering, since the god is not supposed
to bestow his favours gratuitously.92 By the call contained in it he is
invited to partake of the offering, or his attention is drawn to it.93
“Compassionate father!” says the Tanna priest when he offers first-
fruits to a deified ancestor; “here is some food for you, eat it, and be
kind to us on account of it!”94 In one of the Pahlavi texts it is said
that when the guardian spirits of the righteous are invited they
accept the sacrifice, whereas if they are not invited “they go up the
height of a spear and will remain.”95 Throughout the Yasts we hear
of the claims of deities to be worshipped with sacrifices in which
they are invoked by their own names and with the proper words.96
Mithra complains, “If men would worship me with a sacrifice in
which I were invoked by my own name, as they worship the other
Yazatas with sacrifices in which they are invoked by their own
names, then I would come to the faithful at the appointed time.”97
According to Vedic and Zoroastrian texts the gods were purified,
strengthened, and encouraged not only by offerings but by prayers,
although it is difficult in this respect to distinguish between two
elements in one and the same rite which are so closely interwoven
with each other.98 By his invocations man assists the gods in their
combats with evil demons, he sends his prayer between the earth
and the heavens there to smite the fiends.99 In a Vedic hymn the
people are exhorted to “sing to Indra a song very destructive to the
demons.”100 By pronouncing the praise of Asha, Zarathustra brings
the Daevas to naught;101 by mentioning the name of Ahura Mazda
their malice is most effectually destroyed.102 Thus prayer may be a
religious duty also on account of the magic efficacy ascribed to it,
and the same is the case with incantations directed against evil
spirits.
92 Tylor, Primitive Culture, ii. 364 sqq. Georgi, Russia, iii. 272
(shamanistic peoples of Siberia). Maspero, Études de mythologie
et d’archéologie égyptiennes, i. 163; Idem, Dawn of Civilization,
p. 124, n. 5 (ancient Egyptians). Darmesteter, in Sacred Books of
the East, iv. (1st ed.) p. lxix. (Zoroastrians). Oldenberg, op. cit. p.
430 sqq.; Barth, Religions of India, p. 34 (Vedic people).
Donaldson, ‘Expiatory and Substitutionary Sacrifices of the
Greeks,’ in Trans. Roy. Soc. Edinburgh, xxvii. 430. Grimm, Teutonic
Mythology, i. 29. Among the Kafirs of Natal “a soldier wounded in
battle would only pray if his hurt were slight; but if it were
serious, he would vow a sacrifice on his return, naming perhaps
the particular beast” (Shooter, Kafirs of Natal, p. 164).

93 Cf. Brinton, Religions of Primitive Peoples, p. 104.

94 Turner, Nineteen Years in Polynesia, p. 88.

95 Shâyast Lâ-Shâyast, ix. 12.

96 Yasts, viii. 23 sqq.; x. 30.

97 Ibid. x. 55. Cf. ibid. x. 74.

98 See Bergaigne, La religion védique, ii. 237, 250, 273 sqq.;


Zimmer, Altindisches Leben, p. 337 sqq.; Oldenberg, Religion des
Veda, p. 437; Macdonell, Vedic Mythology, p. 60; Meyer,
Geschichte des Alterthums, i. 534 sq. (Zoroastrianism).

99 Yasna, xxviii. 7. Yasts, iii. 5. Vendîdâd, xix. 1, 2, 8 sqq.


Darmesteter, Ormazd et Ahriman, pp. 101, 119, 131, 193. Idem,
in Sacred Books of the East, iv. (1st ed.) p. lxix.

100 Rig-Veda, viii. 78. 1.

101 Yasts, xiii. 89. Cf. ibid. xiii. 90.

102 Ibid. i. 3, 4, 10, 11, 19.


In earlier chapters we have often noticed how curses gradually
develop into genuine prayers, and vice versa may a prayer develop
into a curse or spell. Dr. Rivers observes that the formulæ used in
Toda magic have the form of prayers.103 So also Assyrian
incantations are often dressed in the robe of supplication, and end
with the formula, “Do so and so, and I shall gladden thine heart and
worship thee in humility.”104 Vedic texts which were not originally
meant as charms became so afterwards. Incantations are
comparatively rare in the Rig-Veda, and seem even to be looked
upon as objectionable, but towards the end of the Vedic period the
reign of Brahma, the power of prayer, as the supreme god in the
Indian Pantheon began to dawn.105 Brahma is a force by which the
gods act, by which they are born, and by which the world has been
formed;106 but it is also the prayer which ascends from the altar to
heaven and by means of which man wrests from the gods the boon
he demands107—“the prayer governs them.”108 This omnipresent
force is personified in Brahmaṇaspati, the lord of prayer, who resides
in the highest heaven but of whom not only every separate god but
the priest himself becomes a manifestation at the moment he
pronounces the mantras or sacred texts.109 It is a current saying in
India that the whole universe is subject to the gods, that the gods
are subject to the mantras, that the mantras are subject to the
Brahmans, and that therefore the Brahmans are the real gods.110 In
Zoroastrianism prayers are not made efficacious by devotion and
fervency, but to the words themselves belongs a mysterious power
and the mere recitation of them, if correct and faultless, brings that
power into action;111 in the Yasts prayer is regarded as a goddess,
as the daughter of Ahura Mazda.112 In ancient Egypt, M. Maspero
observes, “la prière n’était pas comme chez nous une petition que
l’homme présente au dieu, et que le dieu est libre d’accepter ou de
refuser à son gré: c’était une formule dont les terms ont une valeur
impérative, et dont l’énonciation exacte oblige le dieu à concéder ce
qu’on lui demande.”113 Greek literature supplies other instances of
men conjuring their gods by incantations;114 the word ἀρά means
both prayer and curse.115 And “in the Roman, as in the majority of
the old Italian cults, prayer is a magic formula, producing its effect
by its own inherent quality.”116
103 Rivers, Todas, pp. 450, 453.

104 Tallqvist, ‘Die assyrische Beschwörungsserie Maqlû,’ in Acta


Soc. Scient. Fennicæ, xx. 22.

105 Oldenberg, op. cit. p. 311 sqq. Hopkins, op. cit. p. 149.
Roth, ‘Brahma und die Brahmanen,’ in Zeitschr. d. Deutschen
Morgenländischen Gesellsch. i. 67, 71. Darmesteter, Essais
orientaux, p. 132.

106 Atharva-Veda, xi. 5. 5. Barth, op. cit. p. 38.

107 Roth, loc. cit. p. 66 sqq. Barth, op. cit. p. 38. Darmesteter,
Ormazd et Ahriman, p. 101.

108 Rig-Veda, vi. 51. 8.

109 Barth, op. cit. p. 15 sq. Roth, loc. cit. p. 71.

110 Monier-Williams, Brāhmanism and Hindūism, p. 201 sq.

111 See Geiger, Civilization of the Eastern Irānians, i. 71.

112 Yasts, xiii. 92; xvii. 16.

113 Maspero, Études de mythologie et archéologie égyptiennes,


i. 163.

114 See Usener, Götternamen, p. 335 sq.

115 Cf. von Lasaulx, Der Fluch bei Griechen und Römern, p. 6.
So also the Manx word gwee means both prayer and curse (Rhys,
Celtic Folklore, i. 349).

116 Renan, Hibbert Lectures on the Influence of the Institutions,


&c. of Rome on Christianity, p. 10 sq. Cf. Jevons, in Plutarch’s
Romane Questions, p. xxviii.; Granger, Worship of the Romans, p.
158.

You might also like