Ebooks File (Ebook PDF) Starting Out With C++: From Control Structures Through Objects 8th Edition All Chapters
Ebooks File (Ebook PDF) Starting Out With C++: From Control Structures Through Objects 8th Edition All Chapters
com
https://ebooksecure.com/product/ebook-pdf-
starting-out-with-c-from-control-structures-
through-objects-8th-edition/
https://ebooksecure.com/product/ebook-pdf-starting-out-with-c-from-
control-structures-through-objects-brief-version-8th-edition/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-objects-7th-edition/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-starting-out-with-c-from-
control-structures-to-objects-9th-edition/
ebooksecure.com
https://ebooksecure.com/product/ebook-pdf-commercial-applications-of-
company-law-2019-20th-edition/
ebooksecure.com
Junqueira’s Basic Histology Text and Atlas 15th Edition
Anthony L. Mescher - eBook PDF
https://ebooksecure.com/download/junqueiras-basic-histology-text-and-
atlas-ebook-pdf-2/
ebooksecure.com
https://ebooksecure.com/download/handbook-of-dialysis-therapy-ebook-
pdf/
ebooksecure.com
https://ebooksecure.com/download/pharmacology-for-medical-
graduates-4th-updated-edition-ebook-pdf-2/
ebooksecure.com
Electrocardiography For Healthcare Professionals Ise
(paperback) 5th Edition - eBook PDF
https://ebooksecure.com/download/electrocardiography-for-healthcare-
professionals-ise-paperback-ebook-pdf/
ebooksecure.com
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 Starting Out with C++: From Control Structures through Objects, 8th edition.
This book is intended for use in a two-semester C++ programming sequence, or an acceler-
ated one-semester course. Students new to programming, as well as those with prior course
work in other languages, will find this text beneficial. The fundamentals of programming
are covered for the novice, while the details, pitfalls, and nuances of the C++ language are
explored in-depth for both the beginner and more experienced student. The book is written
with clear, easy-to-understand language, and it covers all the necessary topics for an intro-
ductory programming course. This text is rich in example programs that are concise, practi-
cal, and real-world oriented, ensuring that the student not only learns how to implement the
features and constructs of C++, but why and when to use them.
xv
Visit https://testbankfan.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
xvi Preface
● The range-based for loop is introduced in Chapter 7. This new looping mechanism
automatically iterates over each element of an array, vector, or other collection,
without the need of a counter variable or a subscript.
● Chapter 7 shows how a vector can be initialized with an initialization list.
● The nullptr key word is introduced as the standard way of representing a null
pointer.
● Smart pointers are introduced in Chapter 9, with an example of dynamic memory
allocation using unique_ptr.
● Chapter 10 discusses the new, overloaded to_string functions for converting numeric
values to string objects.
● The string class’s new back() and front() member functions are included in
Chapter 10’s overview of the string class.
● Strongly typed enums are discussed in Chapter 11.
● Chapter 13 shows how to use the smart pointer unique_ptr to dynamically allocate
an object.
● Chapter 15 discusses the override key word and demonstrates how it can help prevent
subtle overriding errors. The final key word is discussed as a way of preventing a virtual
member function from being overridden.
In addition to the C++11 topics, the following general improvements were made:
● Several new programming problems have been added to the text, and many of the
existing programming problems have been modified to make them unique from previ-
ous editions.
● The discussion of early, historic computers in Chapter 1 is expanded.
● The discussion of literal values in Chapter 2 is improved.
● The introduction of the char data type in Chapter 2 is reorganized to use character
literals in variable assignments before using ASCII values in variable assignments.
● The discussion of random numbers in Chapter 3 is expanded and improved, with the
addition of a new In the Spotlight section.
● A new Focus on Object-Oriented Programming section has been added to Chapter 13,
showing how to write a class that simulates dice.
● A new Focus on Object-Oriented Programming section has been added to Chapter 14,
showing an object-oriented program that simulates the game of Cho-Han. The program
uses objects for the dealer, two players, and a pair of dice.
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 16
Exceptions,
Templates, and STL
Chapter 17
Linked Lists
Chapter 18 Chapter 19
Stacks and Queues Recursion
Chapter 20
Binary Trees
xviii Preface
Chapter 1 covers fundamental hardware, software, and programming concepts. You may
choose to skip this chapter if the class has already mastered those topics. Chapters 2 through
7 cover basic C++ syntax, data types, expressions, selection structures, repetition structures,
functions, and arrays. Each of these chapters builds on the previous chapter and should be
covered in the order presented.
After Chapter 7 has been covered, you may proceed to Chapter 8, or jump to either Chapter
9 or Chapter 12. (If you jump to Chapter 12 at this point, you will need to postpone sections
12.7, 12.8, and 12.10 until Chapters 9 and 11 have been covered.)
After Chapter 9 has been covered, either of Chapters 10 or 11 may be covered. After Chap-
ter 11, you may cover Chapters 13 through 17 in sequence. Next you can proceed to either
Chapter 18 or Chapter 19. Finally, Chapter 20 may be covered.
This text’s approach starts with a firm foundation in structured, procedural programming
before delving fully into object-oriented programming and advanced data structures.
Chapter 6: Functions
In this chapter the student learns how and why to modularize programs, using both void
and value returning functions. Argument passing is covered, with emphasis on when argu-
ments should be passed by value versus when they need to be passed by reference. Scope of
variables is covered, and sections are provided on local versus global variables and on static
local variables. Overloaded functions are also introduced and demonstrated.
Chapter 7: Arrays
In this chapter the student learns to create and work with single and multidimensional
arrays. Many examples of array processing are provided including examples illustrating
how to find the sum, average, highest, and lowest values in an array and how to sum the
rows, columns, and all elements of a two-dimensional array. Programming techniques using
parallel arrays are also demonstrated, and the student is shown how to use a data file as
an input source to populate an array. STL vectors are introduced and compared to arrays.
Chapter 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.
Presently all eyes were turned up the river as the second officer
called out, “There is the Great Pagoda.” Yes, this, the greatest shrine
of the Buddhist world, rising from a little hilltop just behind the main
part of the city of Rangoon, lifted its gilded and glistening form
hundreds of feet skyward. This is the first object of special
importance that is looked for by every traveler going up the Rangoon
River. It is seen before any public building comes into view. But
presently the smoke from the great chimneys of the large rice mills of
Rangoon appeared, and then the city was outlined along a river
frontage of two or three miles. The city has no special attractions, as
viewed from the harbor; but the whole river presents an animated
scene, always interesting even to any one familiar with it, but full of
startling surprises to the newcomer to the East. With the single
exception of Port Said, our missionary party had seen nothing of
Oriental life. The panoramic view of that river and shore life seen on
that last day of 1890 will remain a lifetime in the minds of our party.
Steamers of many nations and sailing-vessels under a score of flags,
native crafts of every description, steam launches by the dozen, and
half a thousand small native boats of a Chinese pattern, called
“sampans,” moved swiftly about the river, while two or three
thousand people crowded the landing and the river front. It is
possible that half a hundred nationalities were represented in that
throng, but to us strangers there were only two distinctions to be
made out clearly: a few men and women with fair skins, and the
remainder of the multitude men of darker hue. “Europeans and
natives” is the general distinction used in all India.
Some incidents at such moments in our lives, as our landing in
this strange country, make profound impressions far above their
actual importance. It was just six o’clock in the evening as we made
fast to the wharf. Suddenly, as I faced the new world life of labor just
before me, and began to contrast it with that of the past, I
remembered that just eleven years before, on that day and at that
hour, allowing for difference of latitude, I stepped off the cars in a
college town, and parted with my old life as a farmer boy for the new
life of a college student. A great change that proved to be, and this
was destined to prove even more in contrast with life hitherto. The
curious circumstance was that the two transitions corresponded by
the year and hour.
I awoke suddenly to the fact of great loneliness. There were
multitudes of people, but in the whole company not a familiar face.
There were some whose names we had heard, and they were ready
to give us a cordial welcome as fellow-workers, but we did not know
them from all the others in the throng in whose thoughts we had no
place. For myself, I have never had a more lonely moment, even
when unattended in the Burma jungles or lost on the mountains at
night.
Another incident, of a painful kind, occurred. As I stood beside
the ship’s doctor, who had been coming and going to India for thirty
years, he volunteered information of the people who were boarding
the ship to greet expected friends. One young lady passenger was
greeted by her sister, whose husband stood by her side. She was a
fair English lady; he was a tall, well-proportioned man of good
features, but he was very dark. The doctor said: “That young lady is
destined to a great disappointment. Her sister is married to a
Eurasian, and she, as an English girl, will have no social recognition
among English people here because she has that Eurasian
relationship.” To my inquiries of interest, he said many things about
these people, in whose veins flow the blood of European and Asiatic,
concluding with the following slander on these people, “They inherit
the vices of both Europeans and Asiatics and the virtues of neither.” I
refer to this expression here to show how such unjust expressions
fall from careless tongues; for I have heard it scores of times,
breathing out unkind, even cruel injustice. It is a slander that is not
often rebuked with the energy its injustice calls for. As I will discuss
this people in another chapter, I only say here that for ten years I
have been connected with them, and while they have their
weaknesses, this charge against them is entirely groundless.
We were presently greeted by the small band of Methodist
missionaries and some of their friends, and taken immediately to our
Girls’ School in the heart of the town. Here we rested in easy-chairs
of an uncouth pattern, but which we have hundreds of times since
had occasion to prove capable of affording great comfort. While
resting and making the acquaintance of Miss Scott, our hostess, an
agent of the Woman’s Foreign Missionary Society, I was impressed
with several features of our new surroundings. Though it was New-
Year’s Eve, the whole house was wide open, and three sides of the
sitting-room had open venetian blinds instead of walls, to let in the
air.
Then we were quickly conscious of the noise, mostly of human
voices, speaking or shouting strange speech in every direction,
which the wooden open-plank house caught up much as a violin
does its sound, and multiplied without transferring them into music.
We came, by later painful experiences, to know that one of the
enemies of nerves and the working force of the missionary in
Rangoon is the ceaseless noise from human throats that seems
inseparable from this Oriental city. I have been in some other noisy
cities, but, as Bishop Thoburn once remarked, our location in
Rangoon was “the noisiest place in the world.” Before these thoughts
had taken full possession of our minds, we were greeted by another
surprise. As we leaned back in the easy-chairs and our eyes sought
the high ceiling of the room, there we saw small lizards moving
about, sometimes indeed stationary, but more often running or
making quick leaps as they caught sluggish beetles or unsuspecting
flies from the ceiling. We counted nine of them in plain view,
seemingly enjoying themselves, unmindful of the presence of the
residents of the building or the nerves or tastes of the new arrivals.
A watch-night service was held that night intended for sailors
and soldiers especially, to which I went, while my wife remained and
rested at the school with our children. At the service I saw for the first
time what is so common in all like gatherings in Eastern cities, the
strange mingling of all people who speak the English language.
Being a seaport, the sailors from every European land were present,
and, so far as they can be secured, attend this wholesome service,
while the soldiers from the garrison come in crowds, and others
interested in these meetings are there also. Every shade of
Eurasians was present. Some of the people whom I saw that night
for the first time became my friends and co-laborers in the Church
and mission for the entire time of which I write. Late that night, or in
the earliest hour of the new year, I fell asleep with my latest
conscious thought, “We are in Burma.”
CHAPTER II
First Year in Burma