C++ How to Program 10th Edition Deitel Solutions Manual
C++ How to Program 10th Edition Deitel Solutions Manual
C++ How to Program 10th Edition Deitel Solutions Manual
C++ How to Program 10th Edition Deitel Solutions Manual
1. Visit https://testbankdeal.com to download the full version and
browse more test banks or solution manuals
C++ How to Program 10th Edition Deitel Solutions
Manual
_____ Press the link below to begin your download _____
https://testbankdeal.com/product/c-how-to-program-10th-
edition-deitel-solutions-manual/
Access testbankdeal.com now to download high-quality
test banks or solution manuals
2. We believe these products will be a great fit for you. Click
the link to download now, or visit testbankdeal.com
to discover even more!
C++ How to Program 10th Edition Deitel Test Bank
https://testbankdeal.com/product/c-how-to-program-10th-edition-deitel-
test-bank/
C How to Program 7th Edition Deitel Solutions Manual
https://testbankdeal.com/product/c-how-to-program-7th-edition-deitel-
solutions-manual/
Visual C# How to Program 6th Edition Deitel Solutions
Manual
https://testbankdeal.com/product/visual-c-how-to-program-6th-edition-
deitel-solutions-manual/
Contemporary Project Management 4th Edition Kloppenborg
Solutions Manual
https://testbankdeal.com/product/contemporary-project-management-4th-
edition-kloppenborg-solutions-manual/
3. Evaluating Practice Guidelines For The Accountable
Professional 6th Edition Bloom Test Bank
https://testbankdeal.com/product/evaluating-practice-guidelines-for-
the-accountable-professional-6th-edition-bloom-test-bank/
Dosage Calculations Canadian 4th Edition Pickar Test Bank
https://testbankdeal.com/product/dosage-calculations-canadian-4th-
edition-pickar-test-bank/
Anthropology Appreciating Human Diversity 16th Edition
Kottak Test Bank
https://testbankdeal.com/product/anthropology-appreciating-human-
diversity-16th-edition-kottak-test-bank/
Making Hard Decisions with DecisionTools 3rd Edition
Clemen Solutions Manual
https://testbankdeal.com/product/making-hard-decisions-with-
decisiontools-3rd-edition-clemen-solutions-manual/
Business Statistics 3rd Edition Sharpe Solutions Manual
https://testbankdeal.com/product/business-statistics-3rd-edition-
sharpe-solutions-manual/
4. Introduction to Probability and Statistics 15th Edition
Mendenhall Solutions Manual
https://testbankdeal.com/product/introduction-to-probability-and-
statistics-15th-edition-mendenhall-solutions-manual/
5. 8
Pointers
O b j e c t i v e s
In this chapter you’ll:
■ Learn what pointers are.
■ Declare and initialize
pointers.
■ Use the address (&) and
indirection (*) pointer
operators.
■ Learn the similarities and
differences between pointers
and references.
■ Use pointers to pass
arguments to functions by
reference.
■ Use built-in arrays.
■ Use const with pointers.
■ Use operator sizeof to
determine the number of
bytes that store a value of a
particular type.
■ Understand pointer
expressions and pointer
arithmetic.
■ Understand the close
relationships between
pointers and built-in arrays.
■ Use pointer-based strings.
■ Use C++11 capabilities,
including nullptr and
Standard Library functions
begin and end.
cpphtp10_08.fm Page 1 Wednesday, August 3, 2016 4:28 PM
6. 2 Chapter 8 Pointers
Self-Review Exercises
8.1 Answer each of the following:
a) A pointer is a variable that contains as its value the of another variable.
ANS: address.
b) A pointer should be initialized to or .
ANS: nullptr, an address.
c) The only integer that can be assigned directly to a pointer is .
ANS: 0.
8.2 State whether each of the following is true or false. If the answer is false, explain why.
a) The address operator & can be applied only to constants and to expressions.
ANS: False. The operand of the address operator must be an lvalue; the address operator
cannot be applied to literals or to expressions that result in temporary values.
b) A pointer that is declared to be of type void* can be dereferenced.
ANS: False. A pointer to void cannot be dereferenced. Such a pointer does not have a type
that enables the compiler to determine the type of the data and the number of bytes
of memory to which the pointer points.
c) A pointer of one type can’t be assigned to one of another type without a cast operation.
ANS: False. Pointers of any type can be assigned to void pointers. Pointers of type void can
be assigned to pointers of other types only with an explicit type cast.
8.3 For each of the following, write C++ statements that perform the specified task. Assume
that double-precision, floating-point numbers are stored in eight bytes and that the starting address
of the built-in array is at location 1002500 in memory. Each part of the exercise should use the re-
sults of previous parts where appropriate.
a) Declare a built-in array of type double called numbers with 10 elements, and initialize
the elements to the values 0.0, 1.1, 2.2, …, 9.9. Assume that the constant size has
been defined as 10.
ANS: double numbers[size]{0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9};
b) Declare a pointer nPtr that points to a variable of type double.
ANS: double* nPtr;
c) Use a for statement to display the elements of built-in array numbers using array sub-
script notation. Display each number with one digit to the right of the decimal point.
ANS: cout << fixed << showpoint << setprecision(1);
for (size_t i{0}; i < size; ++i) {
cout << numbers[i] << ' ';
}
d) Write two separate statements that each assign the starting address of built-in array num-
bers to the pointer variable nPtr.
ANS: nPtr = numbers;
nPtr = &numbers[0];
e) Use a for statement to display the elements of built-in array numbers using pointer/off-
set notation with pointer nPtr.
ANS: cout << fixed << showpoint << setprecision(1);
for (size_t j{0}; j < size; ++j) {
cout << *(nPtr + j) << ' ';
}
cpphtp10_08.fm Page 2 Wednesday, August 3, 2016 4:28 PM
7. Self-Review Exercises 3
f) Use a for statement to display the elements of built-in array numbers using pointer/off-
set notation with the built-in array’s name as the pointer.
ANS: cout << fixed << showpoint << setprecision(1);
for (size_t k{0}; k < size; ++k) {
cout << *(numbers + k) << ' ';
}
g) Use a for statement to display the elements of built-in array numbers using pointer/sub-
script notation with pointer nPtr.
ANS: cout << fixed << showpoint << setprecision(1);
for (size_t m{0}; m < size; ++m) {
cout << nPtr[m] << ' ';
}
h) Refer to the fourth element of built-in array numbers using array subscript notation,
pointer/offset notation with the built-in array’s name as the pointer, pointer subscript
notation with nPtr and pointer/offset notation with nPtr.
ANS: numbers[3]
*(numbers + 3)
nPtr[3]
*(nPtr + 3)
i) Assuming that nPtr points to the beginning of built-in array numbers, what address is
referenced by nPtr + 8? What value is stored at that location?
ANS: The address is 1002500 + 8 * 8 = 1002564. The value is 8.8.
j) Assuming that nPtr points to numbers[5], what address is referenced by nPtr after nPtr
-= 4 is executed? What’s the value stored at that location?
ANS: The address of numbers[5] is 1002500 + 5 * 8 = 1002540.
The address of nPtr -= 4 is 1002540 - 4 * 8 = 1002508.
The value at that location is 1.1.
8.4 For each of the following, write a statement that performs the specified task. Assume that dou-
ble variables number1 and number2 have been declared and that number1 has been initialized to 7.3.
a) Declare the variable doublePtr to be a pointer to an object of type double and initialize
the pointer to nullptr.
ANS: double* doublePtr{nullptr};
b) Assign the address of variable number1 to pointer variable doublePtr.
ANS: doublePtr = &number1;
c) Display the value of the object pointed to by doublePtr.
ANS: cout << "The value of *fPtr is " << *doublePtr << endl;
d) Assign the value of the object pointed to by doublePtr to variable number2.
ANS: number2 = *doublePtr;
e) Display the value of number2.
ANS: cout << "The value of number2 is " << number2 << endl;
f) Display the address of number1.
ANS: cout << "The address of number1 is " << &number1 << endl;
g) Display the address stored in doublePtr. Is the address the same as that of number1?
ANS: cout << "The address stored in fPtr is " << doublePtr << endl;
Yes, the value is the same.
8.5 Perform the task specified by each of the following statements:
a) Write the function header for a function called exchange that takes two pointers to dou-
ble-precision, floating-point numbers x and y as parameters and does not return a value.
ANS: void exchange(double* x, double* y)
cpphtp10_08.fm Page 3 Wednesday, August 3, 2016 4:28 PM
8. 4 Chapter 8 Pointers
b) Write the function prototype without parameter names for the function in part (a).
ANS: void exchange(double*, double*);
c) Write two statements that each initialize the built-in array of chars named vowel with
the string of vowels, "AEIOU".
ANS: char vowel[]{"AEIOU"};
char vowel[]{'A', 'E', 'I', 'O', 'U', '0'};
8.6 Find the error in each of the following program segments. Assume the following declara-
tions and statements:
int* zPtr; // zPtr will reference built-in array z
int number;
int z[5]{1, 2, 3, 4, 5};
a) ++zPtr;
ANS: Error: zPtr has not been initialized.
Correction: Initialize zPtr with zPtr = z; (Parts b–e depend on this correction.)
b) // use pointer to get first value of a built-in array
number = zPtr;
ANS: Error: The pointer is not dereferenced.
Correction: Change the statement to number = *zPtr;
c) // assign built-in array element 2 (the value 3) to number
number = *zPtr[2];
ANS: Error: zPtr[2] is not a pointer and should not be dereferenced.
Correction: Change *zPtr[2] to zPtr[2].
d) // display entire built-in array z
for (size_t i{0}; i <= 5; ++i) {
cout << zPtr[i] << endl;
}
ANS: Error: Referring to an out-of-bounds built-in array element with pointer subscript-
ing.
Correction: To prevent this, change the relational operator in the for statement to <
or change the 5 to a 4.
e) ++z;
ANS: Error: Trying to modify a built-in array’s name with pointer arithmetic.
Correction: Use a pointer variable instead of the built-in array’s name to accomplish
pointer arithmetic, or subscript the built-in array’s name to refer to a specific element.
Exercises
8.7 (True or False) State whether the following are true or false. If false, explain why.
a) Two pointers that point to different built-in arrays cannot be compared meaningfully.
ANS: True.
b) Because the name of a built-in array is implicitly convertible to a pointer to the first el-
ement of the built-in array, built-in array names can be manipulated in the same man-
ner as pointers.
ANS: False. An array name cannot be modified to point to a different location in memory
because an array name is a constant pointer to the first element of the array.
8.8 (Write C++ Statements) For each of the following, write C++ statements that perform the
specified task. Assume that unsigned integers are stored in four bytes and that the starting address
of the built-in array is at location 1002500 in memory.
cpphtp10_08.fm Page 4 Wednesday, August 3, 2016 4:28 PM
9. Exercises 5
a) Declare an unsigned int built-in array values with five elements initialized to the even
integers from 2 to 10. Assume that the constant size has been defined as 5.
ANS: unsigned int values[SIZE]{2, 4, 6, 8, 10};
b) Declare a pointer vPtr that points to an object of type unsigned int.
ANS: unsigned int* vPtr;
c) Use a for statement to display the elements of built-in array values using array sub-
script notation.
ANS: for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << values[i];
}
d) Write two separate statements that assign the starting address of built-in array values
to pointer variable vPtr.
ANS: vPtr = values; and vPtr = &values[0];
e) Use a for statement to display the elements of built-in array values using pointer/offset
notation.
ANS: for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << *(vPtr + i);
}
f) Use a for statement to display the elements of built-in array values using pointer/offset
notation with the built-in array’s name as the pointer.
ANS: for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << *(values + i);
}
g) Use a for statement to display the elements of built-in array values by subscripting the
pointer to the built-in array.
ANS: for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << vPtr[i];
}
h) Refer to the fifth element of values using array subscript notation, pointer/offset nota-
tion with the built-in array name’s as the pointer, pointer subscript notation and point-
er/offset notation.
ANS: values[4], *(values + 4), vPtr[4], *(vPtr + 4)
i) What address is referenced by vPtr + 3? What value is stored at that location?
ANS: The address of the location pertaining to values[3] (i.e., 1002506). 8.
j) Assuming that vPtr points to values[4], what address is referenced by vPtr -= 4? What
value is stored at that location?
ANS: The address of where values begins in memory (i.e., 1002500). 2.
8.9 (Write C++ Statements) For each of the following, write a single statement that performs
the specified task. Assume that long variables value1 and value2 have been declared and value1 has
been initialized to 200000.
a) Declare the variable longPtr to be a pointer to an object of type long.
ANS: long* longPtr;
b) Assign the address of variable value1 to pointer variable longPtr.
ANS: longPtr = &value1;
c) Display the value of the object pointed to by longPtr.
ANS: cout << *longPtr << 'n';
d) Assign the value of the object pointed to by longPtr to variable value2.
ANS: value2 = *longPtr;
e) Display the value of value2.
ANS: cout << value2 << 'n';
f) Display the address of value1.
ANS: cout << &value1 << 'n';
cpphtp10_08.fm Page 5 Wednesday, August 3, 2016 4:28 PM
10. 6 Chapter 8 Pointers
g) Display the address stored in longPtr. Is the address displayed the same as value1’s?
ANS: cout << longPtr << 'n'; yes.
8.10 (Function Headers and Prototypes) Perform the task in each of the following:
a) Write the function header for function zero that takes a long integer built-in array
parameter bigIntegers and a second parameter representing the array’s size and does
not return a value.
ANS: void zero(long bigIntegers[], unsigned int size) or
void zero(long *bigIntegers, unsigned int size)
b) Write the function prototype for the function in part (a).
ANS: void zero(long bigIntegers[], unsigned int size); or
void zero(long *bigIntegers, unsigned int size);
c) Write the function header for function add1AndSum that takes an integer built-in array
parameter oneTooSmall and a second parameter representing the array’s size and returns
an integer.
ANS: int add1AndSum(int oneTooSmall[], unsigned int size) or
int add1AndSum(int *oneTooSmall, unsigned int size)
d) Write the function prototype for the function described in part (c).
ANS: int add1AndSum(int oneTooSmall[], unsigned int size); or
int add1AndSum(int *oneTooSmall, unsigned int size);
8.11 (Find the Code Errors) Find the error in each of the following segments. If the error can be
corrected, explain how.
a) int* number;
cout << number << endl;
ANS: Pointer number does not "point" to a valid address—assigning a valid address of an
int to number would correct this the problem. Also, number is not dereferenced in the
output statement.
b) double* realPtr;
long* integerPtr;
integerPtr = realPtr;
ANS: A pointer of type double cannot be directly assigned to a pointer of type long.
c) int* x, y;
x = y;
ANS: Variable y is not a pointer, and therefore cannot be assigned to x. Change the assign-
ment statement to x = &y; or declare y as a pointer.
d) char s[]{"this is a character array"};
for (; *s != '0'; ++s) {
cout << *s << ' ';
}
ANS: s is not a modifiable value. Attempting to use operator ++ is a syntax error. Changing
to [] notation corrects the problem as in:
for (int t{0}; s[t] != '0'; ++t)
cout << s[t] << ' ';
e) short* numPtr, result;
void* genericPtr{numPtr};
result = *genericPtr + 7;
ANS: A void * pointer cannot be dereferenced.
cpphtp10_08.fm Page 6 Wednesday, August 3, 2016 4:28 PM
11. Exercises 7
f) double x = 19.34;
double xPtr{&x};
cout << xPtr << endl;
ANS: xPtr is not a pointer and therefore cannot be assigned an address. Change xPtr’s type
to double* to correct the problem. The cout statement display’s the address to which
xPtr points (once the previous correction is made)—this is not an error, but normally
you’d output the value of what the pointer points to, not the address stored in the
pointer.
8.13 (What Does This Code Do?) What does this program do?
ANS:
1 // Ex. 8.13: ex08_13.cpp
2 // What does this program do?
3 #include <iostream>
4 using namespace std;
5
6 void mystery1(char*, const char*); // prototype
7
8 int main() {
9 char string1[80];
10 char string2[80];
11
12 cout << "Enter two strings: ";
13 cin >> string1 >> string2;
14 mystery1(string1, string2);
15 cout << string1 << endl;
16 }
17
18 // What does this function do?
19 void mystery1(char* s1, const char* s2) {
20 while (*s1 != '0') {
21 ++s1;
22 }
23
24 for (; (*s1 = *s2); ++s1, ++s2) {
25 ; // empty statement
26 }
27 }
Fig. 8.1 | What does this program do?
Enter two strings: string1 string2
string1string2
cpphtp10_08.fm Page 7 Wednesday, August 3, 2016 4:28 PM
12. 8 Chapter 8 Pointers
8.14 (What Does This Code Do?) What does this program do?
ANS:
Special Section: Building Your Own Computer
In the next several problems, we take a temporary diversion away from the world of high-level-lan-
guage programming. We “peel open” a simple hypothetical computer and look at its internal struc-
ture. We introduce machine-language programming and write several machine-language programs.
To make this an especially valuable experience, we then build a computer (using software-based
simulation) on which you can execute your machine-language programs!1
8.15 (Machine-Language Programming) Let’s create a computer we’ll call the Simpletron. As its
name implies, it’s a simple machine, but, as we’ll soon see, it’s a powerful one as well. The Sim-
pletron runs programs written in the only language it directly understands, that is, Simpletron Ma-
chine Language, or SML for short.
The Simpletron contains an accumulator—a “special register” in which information is put
before the Simpletron uses that information in calculations or examines it in various ways. All
1 // Ex. 8.14: ex08_14.cpp
2 // What does this program do?
3 #include <iostream>
4 using namespace std;
5
6 int mystery2(const char*); // prototype
7
8 int main() {
9 char string1[80];
10
11 cout << "Enter a string: ";
12 cin >> string1;
13 cout << mystery2(string1) << endl;
14 }
15
16 // What does this function do?
17 int mystery2(const char* s) {
18 unsigned int x;
19
20 for (x = 0; *s != '0'; ++s) {
21 ++x;
22 }
23
24 return x;
25 }
Fig. 8.2 | What does this program do?
Enter a string: length
6
1. In Exercises 19.30–19.34, we’ll “peel open” a simple hypothetical compiler that will translate state-
ments in a simple high-level language to the machine language you use here. You’ll write programs
in that high-level language, compile them into machine language and run that machine language on
your computer simulator.
cpphtp10_08.fm Page 8 Wednesday, August 3, 2016 4:28 PM
13. Special Section: Building Your Own Computer 9
information in the Simpletron is handled in terms of words. A word is a signed four-digit decimal
number, such as +3364, -1293, +0007, -0001, etc. The Simpletron is equipped with a 100-word
memory, and these words are referenced by their location numbers 00, 01, …, 99.
Before running an SML program, we must load, or place, the program into memory. The first
instruction (or statement) of every SML program is always placed in location 00. The simulator
will start executing at this location.
Each instruction written in SML occupies one word of the Simpletron’s memory; thus,
instructions are signed four-digit decimal numbers. Assume that the sign of an SML instruction is
always plus, but the sign of a data word may be either plus or minus. Each location in the Sim-
pletron’s memory may contain an instruction, a data value used by a program or an unused (and
hence undefined) area of memory. The first two digits of each SML instruction are the operation
code that specifies the operation to be performed. SML operation codes are shown in Fig. 8.3.
Operation code Meaning
Input/output operations
const int read{10}; Read a word from the keyboard into a specific location in
memory.
const int write{11}; Write a word from a specific location in memory to the
screen.
Load and store operations
const int load{20}; Load a word from a specific location in memory into the
accumulator.
const int store{21}; Store a word from the accumulator into a specific location
in memory.
Arithmetic operations
const int add{30}; Add a word from a specific location in memory to the word
in the accumulator (leave result in accumulator).
const int subtract{31}; Subtract a word from a specific location in memory from
the word in the accumulator (leave result in accumulator).
const int divide{32}; Divide a word from a specific location in memory into the
word in the accumulator (leave result in accumulator).
const int multiply{33}; Multiply a word from a specific location in memory by the
word in the accumulator (leave result in accumulator).
Transfer-of-control operations
const int branch{40}; Branch to a specific location in memory.
const int branchneg{41}; Branch to a specific location in memory if the accumulator
is negative.
const int branchzero{42}; Branch to a specific location in memory if the accumulator
is zero.
const int halt{43}; Halt—the program has completed its task.
Fig. 8.3 | Simpletron Machine Language (SML) operation codes.
cpphtp10_08.fm Page 9 Wednesday, August 3, 2016 4:28 PM
14. 10 Chapter 8 Pointers
The last two digits of an SML instruction are the operand—the address of the memory loca-
tion containing the word to which the operation applies.
Now let’s consider two simple SML programs. The first (Fig. 8.4) reads two numbers from the
keyboard and computes and displays their sum. The instruction +1007 reads the first number from
the keyboard and places it into location 07 (which has been initialized to zero). Instruction +1008
reads the next number into location 08. The load instruction, +2007, places (copies) the first num-
ber into the accumulator, and the add instruction, +3008, adds the second number to the number
in the accumulator. All SML arithmetic instructions leave their results in the accumulator. The store
instruction, +2109, places (copies) the result back into memory location 09. Then the write instruc-
tion, +1109, takes the number and displays it (as a signed four-digit decimal number). The halt
instruction, +4300, terminates execution.
The SML program in Fig. 8.5 reads two numbers from the keyboard, then determines and
displays the larger value. Note the use of the instruction +4107 as a conditional transfer of control,
much the same as C++’s if statement.
Location Number Instruction
00 +1007 (Read A)
01 +1008 (Read B)
02 +2007 (Load A)
03 +3008 (Add B)
04 +2109 (Store C)
05 +1109 (Write C)
06 +4300 (Halt)
07 +0000 (Variable A)
08 +0000 (Variable B)
09 +0000 (Result C)
Fig. 8.4 | SML Example 1.
Location Number Instruction
00 +1009 (Read A)
01 +1010 (Read B)
02 +2009 (Load A)
03 +3110 (Subtract B)
04 +4107 (Branch negative to 07)
05 +1109 (Write A)
06 +4300 (Halt)
07 +1110 (Write B)
08 +4300 (Halt)
09 +0000 (Variable A)
10 +0000 (Variable B)
Fig. 8.5 | SML Example 2.
cpphtp10_08.fm Page 10 Wednesday, August 3, 2016 4:28 PM
15. Special Section: Building Your Own Computer 11
Now write SML programs to accomplish each of the following tasks:
a) Use a sentinel-controlled loop to read positive numbers and compute and display their
sum. Terminate input when a negative number is entered.
ANS:
00 +1009 (Read Value)
01 +2009 (Load Value)
02 +4106 (Branch negative to 06)
03 +3008 (Add Sum)
04 +2108 (Store Sum)
05 +4000 (Branch 00)
06 +1108 (Write Sum)
07 +4300 (Halt)
08 +0000 (Storage for Sum)
09 +0000 (Storage for Value)
b) Use a counter-controlled loop to read seven numbers, some positive and some negative,
and compute and display their average.
ANS:
00 +2018 (Load Counter)
01 +3121 (Subtract Termination)
02 +4211 (Branch zero to 11)
03 +2018 (Load Counter)
04 +3019 (Add Increment)
05 +2118 (Store Counter)
06 +1017 (Read Value)
07 +2016 (Load Sum)
08 +3017 (Add Value)
09 +2116 (Store Sum)
10 +4000 (Branch 00)
11 +2016 (Load Sum)
12 +3218 (Divide Counter)
13 +2120 (Store Result)
14 +1120 (Write Result)
15 +4300 (Halt)
16 +0000 (Variable Sum)
17 +0000 (Variable Value)
18 +0000 (Variable Counter)
19 +0001 (Variable Increment)
20 +0000 (Variable Result)
21 +0007 (Variable Termination)
c) Read a series of numbers, and determine and display the largest number. The first num-
ber read indicates how many numbers should be processed.
ANS:
00 +1017 (Read Endvalue)
01 +2018 (Load Counter)
02 +3117 (Subtract Endvalue)
03 +4215 (Branch zero to 15)
04 +2018 (Load Counter)
05 +3021 (Add Increment)
06 +2118 (Store Counter)
07 +1019 (Read Value)
08 +2020 (Load Largest)
09 +3119 (Subtract Value)
10 +4112 (Branch negative to 12)
11 +4001 (Branch 01)
12 +2019 (Load Value)
13 +2120 (Store Largest)
14 +4001 (Branch 01)
cpphtp10_08.fm Page 11 Wednesday, August 3, 2016 4:28 PM
28. *** END OF THE PROJECT GUTENBERG EBOOK 隨園詩話 ***
Updated editions will replace the previous one—the old editions will
be renamed.
Creating the works from print editions not protected by U.S.
copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.
START: FULL LICENSE
30. PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK
To protect the Project Gutenberg™ mission of promoting the free
distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.
Section 1. General Terms of Use and
Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.
1.B. “Project Gutenberg” is a registered trademark. It may only be
used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
31. 1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E. Unless you have removed all references to Project Gutenberg:
1.E.1. The following sentence, with active links to, or other
immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
32. This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
1.E.2. If an individual Project Gutenberg™ electronic work is derived
from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.
1.E.3. If an individual Project Gutenberg™ electronic work is posted
with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.
1.E.4. Do not unlink or detach or remove the full Project
Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute this
electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
33. with active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
1.E.7. Do not charge a fee for access to, viewing, displaying,
performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.
1.E.8. You may charge a reasonable fee for copies of or providing
access to or distributing Project Gutenberg™ electronic works
provided that:
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
34. about donations to the Project Gutenberg Literary Archive
Foundation.”
• You provide a full refund of any money paid by a user who
notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.
• You provide, in accordance with paragraph 1.F.3, a full refund of
any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™
electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.
1.F.
1.F.1. Project Gutenberg volunteers and employees expend
considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
35. damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.
1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for
the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.
1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you
discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
36. INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
1.F.5. Some states do not allow disclaimers of certain implied
warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,
the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.
Section 2. Information about the Mission
of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.
Volunteers and financial support to provide volunteers with the
assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
37. remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.
Section 3. Information about the Project
Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.
The Foundation’s business office is located at 809 North 1500 West,
Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
38. small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.
The Foundation is committed to complying with the laws regulating
charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.
While we cannot and do not solicit contributions from states where
we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.
International donations are gratefully accepted, but we cannot make
any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Section 5. General Information About
Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
39. Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
This website includes information about Project Gutenberg™,
including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
40. Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
testbankdeal.com