(eBook PDF) Starting Out with C++: From Control Structures through Objects, Brief Version 8th Editionpdf download
(eBook PDF) Starting Out with C++: From Control Structures through Objects, Brief Version 8th Editionpdf download
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-from-
control-structures-through-objects-brief-version-8th-edition/
(eBook PDF) Starting Out with C++: From Control Structures through Objects
8th Edition
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-from-control-
structures-through-objects-8th-edition/
(eBook PDF) Starting Out with Java: From Control Structures through
Objects, 7th Edition
https://ebookluna.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
https://ebookluna.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
https://ebookluna.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
https://ebookluna.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
https://ebookluna.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)
https://ebookluna.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
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-early-
objects-5th-edition/
(eBook PDF) Starting Out with Java: Early Objects 5th Global Edition
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-early-
objects-5th-global-edition/
Contents
Preface xv
vii
viii 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
Welcome to the Brief Version of Starting Out with C++: From Control Structures through
Objects, 8th edition. This book is intended for use in a one or two-semester C++ programming
sequence, or an accelerated one-semester course. Students new to programming, as well as
those with prior course work in other languages, will find this text beneficial. The funda-
mentals 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 introductory programming course. This text is rich in example pro-
grams that are concise, practical, 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.
xv
xvi Preface
l 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.
l Chapter 7 shows how a vector can be initialized with an initialization list.
l The nullptr key word is introduced as the standard way of representing a null
pointer.
l Smart pointers are introduced in Chapter 9, with an example of dynamic memory
allocation using unique_ptr.
l Chapter 10 discusses the new, overloaded to_string functions for converting numeric
values to string objects.
l The string class’s new back() and front() member functions are included in
Chapter 10’s overview of the string class.
l Strongly typed enums are discussed in Chapter 11.
l Chapter 13 shows how to use the smart pointer unique_ptr to dynamically allocate
an object.
l 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:
l 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.
l The discussion of early, historic computers in Chapter 1 is expanded.
l The discussion of literal values in Chapter 2 is improved.
l 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.
l The discussion of random numbers in Chapter 3 is expanded and improved, with the
addition of a new In the Spotlight section.
l A new Focus on Object-Oriented Programming section has been added to Chapter 13,
showing how to write a class that simulates dice.
l 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.
Figure P-1
Chapter 1
Introduction
Chapters 2–7
Basic Language
Elements
*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 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
Chapter 11, you may cover Chapters 13 through 15 in sequence.
This text’s approach starts with a firm foundation in structured, procedural programming
before delving fully into object-oriented programming.
xviii Preface
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.
Preface xix
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 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.
Appendix F: Namespaces
This appendix explains namespaces and their purpose. Examples showing how to define a
namespace and access its members are given.
Places of Interest
A ride from end to end brings into view the following interesting
features:
The Devil's Postoffice is in a recess at the mouth of a ravine.
The Devil's Five Fingers are all that is visible of a sunken tree. The
limbs have been protruding from the water for almost half a century.
Echo Rock is a high promontory on the left, a distinct echo being
heard opposite this interesting feature.
Fern Dell is one of the most attractive places in the whole region.
SCENE AT MIRROR LAKE
SKILLET FALLS
Skillet Falls
Skillet Falls is located about a mile above where the stream tumbles
into the pool at the head of the peaceful valley and may be reached
by following the creek through woods and fields, or by approaching
through the farmyard of Dwight Welch on Trunk Line 12. This place
of interest was named by Levi Moore from the "Skillets" or water-
worn holes in the sandstone rock, looking much like basins or iron
vessels used in cooking.
Stream With Two Beds
Before the time of the glacial epoch Skillet Creek probably emptied
into the Baraboo River where the city of Baraboo is located, two or
three miles below the present confluence. The moraine material
filled a portion of the bed of the stream and after the ice receded it
was forced to find a new course near where three roads meet, a
short distance above Skillet Falls. The upper portion of Skillet Creek
tumbles down the Baraboo Bluffs over a bed which dates to Potsdam
times while the lower portion is of much more recent origin,
something unusual in the history of streams. This interruption in its
career has resulted in the picturesque waterfalls. From the highway
east of Skillet Creek one has a view of the terminal moraine to the
east and of the highly productive outwash plain.
** * * * * * * * * * * * **
* Michael Hirschinger *
* Died *
* March 20, 1853 *
* Age 67 Years *
** * * * * * * * * * * * **
** * * * * * * * * * * * **
* Michael Nippert *
* Died *
* May 23, 1864 *
* Age 70 Years, 2 Months *
** * * * * * * * * * * * **
As to his martial deeds but little is recorded. By his side sleeps his
wife.
Napoleon went to St. Helena; Hirschinger and Nippert came to the
Baraboo Hills.
Hirschinger Spring
A mile and a quarter south of the cemetery, where the road bends to
avoid plunging into it, a spring of delicious water bursts from the
hillside and escapes into the quietude of a wooded dale. This
obscure valley is known as Pine Hollow and the tortuous streamlet,
which finds its way for almost a mile through the towering timber of
this delightful retreat, is known as Pine Creek. Ferns, mosses, and
certain varieties of wild flowers hide the gray of the rocks which are
piled high above the stream. The dale is one of great attractiveness
to a loiterer through this unfrequented wood of the Baraboo Hills.
CHAPTER VIII
A Deer Mound
On the way to the site of the man mound, a deer mound may be
visited at 727 Eighth Street, Baraboo, (on Trunk Line 33, Baraboo to
Portage) in an oak grove, on land owned by Mrs. Catherine Crandall
Train. The rear portion of this mound, a rare effigy, was destroyed a
number of years ago. A linear mound may be seen just back of the
effigy.
Continuing on the trunk line two miles, a turn is made to the left, the
highway approaching a rugged elevation on the left side of the road.
This outcrop of sandstone is known locally as Rocky Point or Violet
Hill, from the abundance of violets which carpet its slopes in the
spring. Violent Hill would perhaps be a better appellation as the
point has been responsible for a number of serious accidents. Early
in the history of this region a bold frontiersman made the wrong
turn, because of a maudlin mind acquired in the village by
overindulgence in rum, and his wagon, tipping over, his life was
snuffed out on the rocks.
About the year 1870 another devotee of Bacchus became a sacrifice.
Before his team had reached the top of the hill this confused
husbandman, thinking he was at the turn in the road, directed his
horses into the rocks and by the overturning of his wagon-box, was
killed.
Another victim was an employee of a hop yard located near the man
mound. One night this individual walked down the slope north of the
hill but instead of following the highway skirting the rocks, he walked
directly over the crest. Stepping into the darkness, he fell headlong
down the declivity barely escaping death.
Only a few years since, a driver and team came down this same
north slope in a snow storm. The snowdrifts were deep and the
driver finally abandoned his conveyance, walking behind his horses
in an endeavor to follow the road. Blinded by the falling snow and
confused by the drifts, man and team plunged over the cliff and
were only saved from destruction by the abundance of snow. So
deep were the drifts that little could be seen of the horses after the
tumble, except their ears.
** * * * * * * * * * * * * * * **
* YELLOW THUNDER *
* Chief of the Winnebago *
* Born 1774—Died 1874 *
* —— *
* And His Squaw *
* Died 1868 *
** * * * * * * * * * * * * * * **
Yellow Thunder, a noted warrior and chief of the Winnebago, was "to
the manor born." With his tribe he probably took part, on the side of
the British, in the War of 1812.
He was buried three days after he had passed to the happy hunting
grounds, his body laid in a box in a horizontal position with face to
the west, and his pipe and various trinkets around. His squaw was
interred in similar fashion except that the body was placed in a
sitting position. The ceremonies in both instances were conducted by
Indians, white neighbors assisting only in bearing the bodies to the
graves.
Yellow Thunder is said to have been a "man of great respectability
among his people, and an able councilor in all their public affairs. He
was a zealous Catholic."
In an interview, (see Wisconsin Historical Collections) Moses
Paquette said of him that he was a fine looking Indian, tall, straight,
and stately, but had an overweening love for firewater. This was his
only vice.
Forcibly Removed
YELLOW THUNDER
Pillar Erected
In 1909, it was decided by members of the Sauk County Historical
Society to remove the remains of Yellow Thunder and his squaw to a
new location, fearing that by clearing and cultivating the land the
graves would become obliterated. An excavation was made, the
bones were placed in a large vitrified tile, and the cairn erected, the
earthen receptacle becoming a part of the boulder-made ossuary.
Here, near a familiar trail, not far from the white neighbors with
whom the Indians often mingled and sometimes ate, the remains
rest in this enduring sepulcher.
From Waubun
The following incidents taken from Wau-Bun, a narrative of the early
days at Fort Winnebago, by Mrs. J. H. Kinzie, show some of the
characteristics of the squaw of Yellow Thunder.
Among the women with whom I early made acquaintance was the
wife of Wau-kaun-zee-kah, the Yellow Thunder. She had
accompanied her husband, who was one of the deputation to visit
the President, and from that time forth she had been known as "the
Washington woman." She had a pleasant, old-acquaintance sort of
air in greeting me, as much as to say, "You and I have seen
something of the world." No expression of surprise or admiration
escaped her lips, as her companions, with childlike laughing
simplicity, exclaimed and clapped their hands at the different
wonderful objects I showed them. Her deportment said plainly, "Yes,
yes, my children, I have seen all these things before." It was not
until I put to her ear a tropical shell of which I had a little cabinet,
and she heard its murmuring sound, that she laid aside her apathy
of manner. She poked her finger into the opening to get at the
animal within, shook it violently, then raised it to her ear again, and
finally burst into a hearty laugh, and laid it down, acknowledging by
her looks, that this was beyond her comprehension.
I had one shell of peculiar beauty—my favorite in the whole
collection—a small conch, covered with rich, dark veins. Each of the
visitors successively took up this shell, and by words and gestures
expressed her admiration, evidently showing that she had an eye for
beauty—this was on the occasion of the parting visit of my red
daughters.
Shortly after the payment had been completed and the Indians had
left, I discovered that my valued shell was missing from the
collection. Could it be that one of the squaws had stolen it? It was
possible—they would occasionally, though rarely do such things
under the influence of strong temptation. I tried to recollect which
among the party, looked most likely to have been the culprit. It
could not have been the Washington woman—she was partly
civilized and knew better.
A few weeks afterward Mrs. Yellow Thunder again made her
appearance and carefully unfolding a gay colored chintz shawl,
which she carried rolled up in her hand, she produced the shell, and
laid it on the table before me. I did not know whether to show by
my countenance displeasure at the trick she had played me, or joy
at receiving my treasure back again, but at last decided it was the
best policy to manifest no emotion whatever.
She prolonged her visit until my husband's return, and he then
questioned her about the matter.
"She had taken the shell to her village, to show to some of her
people, who did not come to the payment."
"Why had she not asked her mother's leave before carrying it
away?"
"Because she saw that her mother liked the shell, and she was afraid
she would say, No."
This was not the first instance in which Madame Washington had
displayed the shrewdness which was a predominant trait in her
character. During the visit of the Indians to the Eastern cities, they
were taken to various exhibitions, museums, menageries, theatres,
etc. It did not escape their observation that some silver was always
paid before entrance and they inquired the reason. It was explained
to them. The woman brightened up as if struck with an idea.
"How much do you pay for each one?"
Her father told her.
"How do you say that in English?"
"Two shillings."
"Two shinnin——humph" (good).
The next day, when as usual, visitors began to flock to the rooms
where the Indians were sojourning, the woman and a young Indian,
her confederate, took their station by the door, which they kept
closed. When any one knocked, the door was cautiously opened,
and the woman, extending her hand exclaimed—"Two shinnin."
This was readily paid in each instance, and the game went on, until
she had accumulated a considerable sum. But this did not satisfy
her. At the first attempt of a visitor to leave the room, the door was
held close, as before, the hand was extended, and "two shinnin"
again met his ear. He tried to explain that, having paid for his
entrance, he must go out free. With an innocent shake of the head,
"Two shinnin" was all the English she could understand.
The agent, who had entered a short time before, and who
overhearing the dialogue, sat laughing behind his newspaper,
waiting to see how it would all end, now came forward and
interfered, and the guests were permitted to go forth without further
contribution.
CHAPTER X
Roche Moutonnee
After passing a road which turns to the left and leads to the man
mound, a roche moutonnee, sheep shaped surface of the quartzite,
may be seen about a half-mile to the left. The surface of the outcrop
was rounded during the invasion of the glacial ice into this region.
Just before reaching the Baraboo River the road swings to the left,
approaching the talused slope of the rugged north range of the
Baraboo Bluffs. Two species of cacti grow on the summit here, also
to the west—Opuntia humifusa, the western prickly pear, and
Opuntia fragilis, the brittle opuntia.
The road runs on the verge of a dry ravine, where an Indian effigy
mound reposes on the opposite bank, near the Baraboo River. Other
mounds were to the west and an Indian ford crossed the stream
here. About 1906 an Indian skeleton was unearthed on the bank of
the gully, nearly opposite the farmstead.
Garrisonville
In the region about the ravine, Mrs. Ann Garrison, in pioneer times,
laid out a paper city, much to the regret of lot purchasers in
Philadelphia and elsewhere. The sawmill, the pottery, the hotel, and
the "salted" gold mine are but memories now.
The gap where the river escapes from the valley into the lowland to
the north, has a geological history similar to that of Devil's Lake. No
talus covers the slopes, however, the loose stones having been
swept away when the ice sheet flowed slowly through in glacial
times.
JEFFERSON DAVIS
Road Hugs the Bluff
Eastward from the bridge over the Baraboo River, the highway hugs
the bluff. A few Indian mounds may be seen less than half a mile to
the north after passing the first farm house. To the east of these
mounds the skeletons of about sixty Indians were uncovered when
one was leveled a number of years ago. The Indian corpses had
been seated in a circle and buried in one heap of earth. Evidently
there had been a battle or pestilence amongst them.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookluna.com