(eBook PDF) Starting Out with C++: From Control Structures through Objects, Brief Version 8th Edition all chapter instant download
(eBook PDF) Starting Out with C++: From Control Structures through Objects, Brief Version 8th Edition all chapter instant download
com
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-through-objects-brief-version-8th-
edition/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-from-
control-structures-through-objects-8th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-objects-7th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-from-
control-structures-to-objects-9th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-3rd-edition/
ebookluna.com
(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/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-c-early-
objects-9th-edition/
ebookluna.com
https://ebookluna.com/product/starting-out-with-c-early-objects-9th-
edition-by-tony-gaddis-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-early-
objects-5th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-starting-out-with-java-early-
objects-5th-global-edition/
ebookluna.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 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.
Warnings Warnings are notes that caution the student about certain C++
features, programming techniques, or practices that can lead to
malfunctioning programs or lost data.
Case Studies Case studies that simulate real-world applications appear in
many chapters throughout the text. These case studies are de-
signed to highlight the major topics of the chapter in which they
appear.
Review Questions Each chapter presents a thorough and diverse set of review
and Exercises questions, such as fill-in-the-blank and short answer, that check
the student’s mastery of the basic material presented in the chap-
ter. These are followed by exercises requiring problem solving
and analysis, such as the Algorithm Workbench, Predict the Out-
put, and Find the Errors sections. Answers to the odd-numbered
review questions and review exercises can be downloaded from
the book’s Companion Web site at www.pearsonhighered.com/
gaddis.
Programming Each chapter offers a pool of programming exercises designed
Challenges to solidify the student’s knowledge of the topics currently being
studied. In most cases the assignments present real-world prob-
lems to be solved. When applicable, these exercises include input
validation rules.
Group Projects There are several group programming projects throughout the
text, intended to be constructed by a team of students. One
student might build the program’s user interface, while another
student writes the mathematical code, and another designs and
implements a class the program uses. This process is similar to
the way many professional programs are written and encourages
team work within the classroom.
Software Available for download from the book’s Companion Web site at
Development www.pearsonhighered.com/gaddis. This is an ongoing project
Project: that instructors can optionally assign to teams of students. It
Serendipity systematically develops a “real-world” software package: a
Booksellers point-of-sale program for the fictitious Serendipity Booksellers
organization. The Serendipity assignment for each chapter adds
more functionality to the software, using constructs and tech-
niques covered in that chapter. When complete, the program will
act as a cash register, manage an inventory database, and produce
a variety of reports.
C++ Quick For easy access, a quick reference guide to the C++ language is
Reference Guide printed on the last two pages of Appendix C in the book.
Supplements
Student Online Resources
Many student resources are available for this book from the publisher. The following items
are available on the Gaddis Series Companion Web site at www.pearsonhighered.com/gaddis:
l The source code for each example program in the book
l Access to the book’s companion VideoNotes
l A full set of appendices, including answers to the Checkpoint questions and answers
to the odd-numbered review questions
l A collection of valuable Case Studies
l The complete Serendipity Booksellers Project
Instructor Resources
The following supplements are available to qualified instructors only:
• Answers to all Review Questions in the text
• Solutions for all Programming Challenges in the text
• PowerPoint presentation slides for every chapter
• Computerized test bank
• Answers to all Student Lab Manual questions
• Solutions for all Student Lab Manual programs
Visit the Pearson Instructor Resource Center (www.pearsonhighered.com/irc) for
information on how to access instructor resources.
xxiv Preface
All were prostrate on their faces, and all alike, with the
exception of the few who had already received a blessing,
were in an agony of repentance. Sometimes they beat their
foreheads and hands against the floor, sometimes they
literally writhed in anguish, roaring as if the very devils were
tearing them; and then at last, when there seemed no more
power of resistance left, they would spring to their feet and
with terrible sobs and crying, pour out their confessions of
sin. And such confessions! It was like hell uncovered.
Everything from murder, adultery, and the most inconceivable
abominations of uncleanness, through arson, drunkenness,
robbery, thieving, lying, down to hatreds, spites, and
envyings, was emptied out, and with what shame and
loathing!
At the meeting of the second evening, before even the
leader took his place, the tide of prayer began rising, and
although three young men arose one after another, and
attempted to lead in prayer, their voices were not heard in the
tumult of intercessory supplication that broke out. As prayer
continued the building began to resound with groans and
cries. Many fell forward on their faces and wallowed on the
floor. When something like a semblance of order could be
restored, an opportunity was given to all who had any ill-
feeling toward any one present, or who had wronged any of
the others in any way, to make confession and ask
forgiveness. In a very few minutes the meeting was resolved
into numberless groups of students weeping in each other’s
arms. Nor did the members of the faculty escape; and it was
interesting to see them, with perhaps two or three boys
weeping at their knees, and others hanging about their necks.
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