Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

C++ How to Program 10th Edition Deitel

Solutions Manual
Go to download the full and correct content document:
https://testbankfan.com/product/c-how-to-program-10th-edition-deitel-solutions-manu
al/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

C++ How to Program 10th Edition Deitel Test Bank

https://testbankfan.com/product/c-how-to-program-10th-edition-
deitel-test-bank/

C How to Program 7th Edition Deitel Solutions Manual

https://testbankfan.com/product/c-how-to-program-7th-edition-
deitel-solutions-manual/

Visual C# How to Program 6th Edition Deitel Solutions


Manual

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-solutions-manual/

C How to Program 7th Edition Deitel Test Bank

https://testbankfan.com/product/c-how-to-program-7th-edition-
deitel-test-bank/
Visual C 2012 How to Program 5th Edition Deitel
Solutions Manual

https://testbankfan.com/product/visual-c-2012-how-to-program-5th-
edition-deitel-solutions-manual/

Visual C# How to Program 6th Edition Deitel Test Bank

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-test-bank/

Visual C How to Program 6th Edition Deitel Test Bank

https://testbankfan.com/product/visual-c-how-to-program-6th-
edition-deitel-test-bank-2/

C++ How to Program Early Objects Version 9th Edition


Deitel Solutions Manual

https://testbankfan.com/product/c-how-to-program-early-objects-
version-9th-edition-deitel-solutions-manual/

Visual C 2012 How to Program 5th Edition Deitel Test


Bank

https://testbankfan.com/product/visual-c-2012-how-to-program-5th-
edition-deitel-test-bank/
cpphtp10_08.fm Page 1 Wednesday, August 3, 2016 4:28 PM

Pointers 8
Objectives
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 2 Wednesday, August 3, 2016 4:28 PM

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 3 Wednesday, August 3, 2016 4:28 PM

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 4 Wednesday, August 3, 2016 4:28 PM

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 5 Wednesday, August 3, 2016 4:28 PM

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 6 Wednesday, August 3, 2016 4:28 PM

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 7 Wednesday, August 3, 2016 4:28 PM

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?

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?

ANS:

Enter two strings: string1 string2


string1string2
cpphtp10_08.fm Page 8 Wednesday, August 3, 2016 4:28 PM

8 Chapter 8 Pointers

8.14 (What Does This Code Do?) What does this program do?

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?

ANS:

Enter a string: length


6

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. 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 9 Wednesday, August 3, 2016 4:28 PM

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 10 Wednesday, August 3, 2016 4:28 PM

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.

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.

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 +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 11 Wednesday, August 3, 2016 4:28 PM

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 12 Wednesday, August 3, 2016 4:28 PM

12 Chapter 8 Pointers

15 +1120 (Write Largest)


16 +4300 (Halt)
17 +0000 (Variable EndValue)
18 +0000 (Variable Counter)
19 +0000 (Variable Value)
20 +0000 (Variable Largest)
21 +0001 (Variable Increment)
Another random document with
no related content on Scribd:
The Project Gutenberg eBook of Plants and
their children
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.

Title: Plants and their children

Author: Frances Theodora Parsons

Illustrator: Alice Josephine Smith

Release date: October 23, 2023 [eBook #71942]

Language: English

Original publication: New York: American Book Company, 1896

Credits: Bob Taylor, the Online Distributed Proofreading Team at


https://www.pgdp.net (This file was produced from
images generously made available by The Internet
Archive)

*** START OF THE PROJECT GUTENBERG EBOOK PLANTS AND


THEIR CHILDREN ***
PLANTS

AND THEIR CHILDREN

BY

MRS. WILLIAM STARR DANA


AUTHOR OF “HOW TO KNOW THE WILD FLOWERS”

ILLUSTRATED BY
ALICE JOSEPHINE SMITH

NEW YORK CINCINNATI CHICAGO


AMERICAN BOOK COMPANY
Copyright, 1896, by
AMERICAN BOOK COMPANY.

DANA’S PLANTS.

W. P. 2
PREFACE

A CHILD’S reading book, it seems to me, should secure for the


child three things,—practice in the art of reading, amusement,
and instruction. Whether my little book is fitted to attain this threefold
object, others must decide; but in laying it before the public, let me
urge careful attention to a few suggestions.
1. As the book is arranged so as to begin with the opening of the
school year and to follow it to its close, the interest of pupils will be
increased by reading the different chapters during the seasons to
which they refer.
2. The teacher should exercise judgment as to the omission of any
chapter or group of chapters which may seem beyond the
comprehension of the class. With a little care, such an omission may
nearly always be made without injury to the usefulness of the rest of
the book.
3. Specimens of the objects described, when these can be found
in the locality, should always be on exhibition in the schoolroom.
Whenever possible, the children themselves should collect and
handle these specimens. If for any reason this collection by the
children cannot be accomplished, the teacher should not fail to
anticipate the readings, and to provide the objects mentioned.
By the observance of these simple and practicable suggestions, it
is believed that, while the children are being trained in the art of
reading, their powers of observation and of reasoning will be
developed, and that they will be inspired with a lifelong interest in
nature. The child’s mind is peculiarly alive to the charm of nature
when she is studied in detail, and through her it can be trained to
observe accurately and to reason logically.
Through the neglect of nature study, the wits of the country child
lose just the sharpening they most need, to say nothing of a stimulus
and delight which can ill be spared by one whose mental life is apt to
be monotonous.
The wits of the city child may secure in other ways the sharpening
so essential to success in life; yet the training afforded by a logical
study of plants, and the pleasure which such a study, rightly directed,
is sure to yield, are as invaluable to him as to his country cousin.
Experience having proved to my keenest satisfaction that almost
invariably children can be interested in stories of plants and their
children, to the children of the land I offer this little book, in the
earnest hope that its pages may lead at least some few of them to
find in life a new joy and a deeper meaning.
The aid derived from many sources in the preparation of “Plants
and their Children” is heartily acknowledged; but more especially I
wish to extend my thanks to Messrs. Holt & Co. for their courtesy in
allowing the reproduction of several cuts from their valuable and
interesting publication, “The Natural History of Plants,” translated
from the German of Kerner von Marilaun.
CONTENTS

PART I.—FRUITS AND SEEDS


PAGE
In the Orchard 9
The Story of the Bee 16
The Apple’s Treasures 19
What a Plant lives for 21
The World without Plants 24
How the Apple shields its Young 27
Some Cousins of the Apple 31
Uneatable Fruits 34
More Cousins of the Apple 36
Still more Cousins 39
In the Woods 41
Why Seeds travel 50
Some Little Tramps 52
Seed Sailboats 56
Winged Seeds 61
Shooting Seeds 63
The Chestnut and Other Seeds 67
Some Strange Stories 69
PART II.—YOUNG PLANTS
How the Baby Plant lives 75
A Schoolroom Garden 79
A Schoolroom Garden (Concluded) 85
Seeds as Food 89
An Impatient Plant Baby 91
A Humpbacked Plant Baby 94
PART III.—ROOTS AND STEMS
Root Hairs 99
Roots and Underground Stems 102
Above-ground Roots 106
What Few Children know 112
Plants that cannot stand alone 114
Some Habits of Stems 117
Stems and Seed Leaves 119
“Well done, Little Stem” 122
PART IV.—BUDS
Buds in Winter 125
A Happy Surprise 127
Some Astonishing Buds 129
PART V.—LEAVES
How to look at a Leaf 135
The most Wonderful Thing in the World 138
How a Plant is built 142
How a Plant’s Food is cooked 143
A Steep Climb 147
How a Plant perspires 148
How a Plant stores its Food 149
Leaf Green and Sunbeam 151
Plant or Animal? 154
How we are helped by Leaf Green and Sunbeam 156
How a Plant breathes 158
The Diligent Tree 160
Leaves and Roots 162
Leaf Veins 165
Leaf Shapes 167
Hairy Leaves 170
Woolly and “Dusty” Leaves 172
Prickles and Poison 174
Some Cruel Traps 176
More Cruel Traps 181
The Fall of the Leaf 184
PART VI.—FLOWERS
The Building Plan of the Cherry Blossom 187
Lilies 191
About Stamens 193
Flower Dust, or Pollen 196
About Pistils 197
The First Arrival 202
Pussy Willows 205
Alders and Birches 207
The Great Trees 209
The Unseen Visitor 211
Plant Packages 214
Underground Storehouses 216
Different Building Plans 217
A Celebrated Family 222
Clever Customs 225
Flowers that turn Night into Day 228
Horrid Habits 230
The Story of the Strawberry 232
A Cousin of the Strawberry 235
Another Cousin 238
Pea Blossoms and Peas 240
The Clover’s Trick 243
More Tricks 244
An Old Friend 247
The Largest Plant Family in the World 248
Robin’s Plantain, Golden-rod, and Aster 251
The Last of the Flowers 254
PART VII.—LEARNING TO SEE
A Bad Habit 257
A Country Road 261
A Holiday Lesson 264
PLANTS AND THEIR CHILDREN
Part I—Fruits and Seeds

IN THE ORCHARD

I S there a nicer place in which to play than an old apple orchard?


Once under those favorite trees whose branches sweep the
ground, you are quite shut off from the great, troublesome, outside
world. And how happy and safe you feel in that green world of your
own!—a world just made for children, a world of grass and leaves
and birds and flowers, where lessons and grown-up people alike
have no part.
In the lightly swinging branches you find prancing horses, and on
many a mad ride they carry you. The larger ones are steep paths
leading up mountain sides. Great chasms yawn beneath you. Here
only the daring, the cool-headed, may hope to be successful and
reach the highest points without danger to their bones.
Out here the girls bring their dolls, and play house. Nothing can
make a more interesting or a more surprising house than an apple
tree, its rooms are so many and of such curious shapes. Then, too,
the seats in these rooms are far more comfortable than the chairs
used by ordinary people in everyday houses. The doings of the
Robin family are overlooked by its windows. One is amazed to see
how many fat worms Mother Robin manages to pop down the
yawning baby throats, and wonders how baby robins ever live to
grow up.
From these windows you watch the first flying lesson; and you
laugh to see the little cowards cling to the branch close by, paying
little heed to their parents’ noisy indignation. All the same, you wish
that you too might suddenly grow a pair of wings, and join the little
class, and learn to do the one thing that seems even more delightful
than tree climbing.
That you children long to be out of the schoolroom this minute, out
in the orchard so full of possibilities, I do not wonder a bit. But as the
big people have decided that from now on for some months you
must spend much of your time with lesson books, I have a plan to
propose.
What do you say to trying to bring something of the outdoor places
that we love into the schoolroom, which we do not love as much as
we should if lessons were always taught in the right way?
Now let us pretend—and even grown-up people, who can do
difficult sums, and answer questions in history and geography better
than children, cannot “pretend” one half so well—now let us pretend
that we are about to spend the morning in the orchard.
Here we go, out of the schoolroom into the air and sunshine, along
the road, up the hill, till we reach the stone wall beyond which lies
our orchard.
Ah! it is good to get into the cool of the dear, friendly trees. And
just now, more than ever, they seem friendly to you boys and girls;
for they are heavy with apples,—beautiful red and golden apples,
that tempt you to clamber up into the green sea of leaves above.
Now let us “pretend” that you have had your fill, and are ready to
gather quietly about me on the long grass. But first, please, one of
you bring me an apple. Let it be well-grown and rounded, with a rosy,
sun-burned cheek; for, as we are to spend some little time with this
apple, the more perfect it is in shape, the richer in color, the sounder
all the way through, the better. It is good to be as much as possible
with things that are beautiful and wholesome and hearty, even
though they are only apples.

Fig. 1

Here we have (Fig. 1) a fine specimen. What do you know, any of


you, about this apple? Perhaps this seems a strange question. But
when we see something that is fine and beautiful, is it strange that
we wish to know its history? If I see a man or a woman who seems
to me all that a man or woman should be; if he or she is fine-looking
and fine-acting, straight and strong, and beautiful and kind, and
brave and generous,—I ask, “Who is he? Where does she come
from? What have they done?”
Of course, a fine apple is not so interesting as a fine man or
woman, or as a fine boy or girl. Still there is much of interest to learn
even about an apple.
None of you seems anxious to tell the apple’s story, so I shall have
to start you with some questions.
Do you remember playing in this same orchard last spring?
Yes, you have not forgotten those Saturdays in May. The trees
were all pink and white with apple blossoms. The air was sweet with
fragrance, and full of the voices of birds, and of bees that were
bustling about from flower to flower. No, indeed! you have not
forgotten those happy mornings. What is more, you never will. They
are among the things that will stay by you, and be a rest and help to
you all your lives. I wish there were no child living that might not
carry with him always the memory of May days in an apple orchard.
How has it come about, do you suppose, that these trees which in
May were covered with flowers are now heavy with apples?
Can any of you children answer this riddle? How have these great
apples managed to take the place of the delicate apple blossoms?
There are some children who keep their eyes open, and really see
what is going on about them, instead of acting as if they were quite
blind; and perhaps some such child will say, “Oh, yes! I know how it
happened. I have seen it all,” and will be able to tell the whole story
at once.
I should like very much to meet that boy or girl, and I should like to
take a country walk with him or her; for there are so few children, or
grown people either, who use both their eyes to see with, and the
brain which lies back of their eyes to think and question with, that it is
a rare treat to meet and to go about with one of them.
But I should be almost as much pleased to meet the child who
says, “Well, I know that first the blossoms come. Early in May they
make the orchard so nice to play in. But in a few days they begin to
fall. Their little white leaves come dropping down like snowflakes;
and soon after, if you climb out along the branches and look close,
where there was a blossom before, you find now a little green thing
something like a knob (Fig. 2). This tiny knob keeps growing bigger
and bigger, and then you see that it is a baby apple. As the weeks go
by, the little apple grows into a big one; and at last the green begins
to fade away, and the red and yellow to come. One day you find the
great grown apple all ripe, and ready to eat. But I never could see
just what made it come like that, such a big, heavy apple from such a
little flower, and I always wondered about it.”
Fig. 2

Now, if we wonder about the things we see, we are on the right


road. The child who first “sees” what is happening around him, and
then “wonders” and asks questions, is sure to be good company to
other people and to himself. (And as one spends more time with
himself than with any one else, he is lucky if he finds himself a
pleasant companion.) Such a child has not lost the use of his eyes,
as so many of us seem to have done. And when the little brain is full
of questions, it bids fair to become a big brain, which may answer
some day the questions the world is asking.
Before I tell you just how the big apple managed to take the place
of the pretty, delicate flower, let us take a good look at this flower.
But in September apple flowers are not to be had for the asking.
Not one is to be found on all these trees. So just now we must use
the picture instead. And when May comes, your teacher will bring
you a branch bearing the beautiful blossoms; or, better still, perhaps
she will take you out into the orchard itself, and you can go over this
chapter again with the lovely living flowers before you.

You might also like