(Ebook PDF) Brief C++: Late Objects, 3rd Edition 2024 Scribd Download
(Ebook PDF) Brief C++: Late Objects, 3rd Edition 2024 Scribd Download
com
https://ebooksecure.com/product/ebook-pdf-brief-c-
late-objects-3rd-edition/
http://ebooksecure.com/product/ebook-pdf-big-c-late-objects-3rd-
edition/
http://ebooksecure.com/product/ebook-pdf-java-concepts-late-
objects-3rd-edition/
http://ebooksecure.com/product/ebook-pdf-big-java-late-
objects-2nd-edition/
http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-through-objects-brief-version-8th-
edition/
(eBook PDF) Java How to Program, Late Objects Global
Edition 11th Edition
http://ebooksecure.com/product/ebook-pdf-java-how-to-program-
late-objects-global-edition-11th-edition/
http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
early-objects-9th-edition/
http://ebooksecure.com/product/c-how-to-program-early-objects-
version-9th-edition-ebook-pdf/
http://ebooksecure.com/product/starting-out-with-c-early-
objects-9th-edition-by-tony-gaddis-ebook-pdf/
http://ebooksecure.com/product/ebook-pdf-starting-out-with-c-
from-control-structures-to-objects-9th-edition/
BriefC++
Cay Horstmann
Late Objects
3/e
vi Preface
Example Table Example table activities make the student the active participant in
building up tables of code examples similar to those found in the book. The tables
come in many different forms. Some tables ask the student to determine the output of
a line of code, or the value of an expression, or to provide code for certain tasks. This
activity helps students assess their understanding of the reading—while it is easy to
go back and review.
Algorithm Animation An algorithm animation shows the essential steps of an
algorithm. However, instead of passively watching, students get to predict each step.
When finished, students can start over with a different set of inputs. This is a surpris-
ingly effective way of learning and remembering algorithms.
Rearrange Code Rearrange code activities ask the student to arrange lines of code
by dragging them from the list on the right to the area at left so that the resulting code
fulfills the task described in the problem. This activity builds facility with coding
structure and implementing common algorithms.
Object Diagram Object diagram activities ask the student to create a memory
diagram to illustrate how variables and objects are initialized and updated as sample
code executes. The activity depicts variables, objects, and references in the same way
as the figures in the book. After an activity is completed, pressing “Play” replays the
animation. This activity goes beyond hand-tracing to illuminate what is happening in
memory as code executes.
Code Completion Code completion activities ask the student to finish a partially-
completed program, then paste the solution into CodeCheck (a Wiley-based online
code evaluator) to learn whether it produces the desired result. Tester classes on the
CodeCheck site run and report whether the code passed the tests. This activity serves
as a skill-building lab to better prepare the student for writing programs from scratch.
Appendices
Appendices A and B summarize C++ reserved words and operators. Appendix C
lists character escape sequences and ASCII character code values. Appendix D docu-
ments all of the library functions and classes used in this book.
Appendix E contains a programming style guide. Using a style guide for program
ming assignments benefits students by directing them toward good habits and reduc-
ing gratuitous choice. The style guide is available in electronic form on the book’s
companion web site so that instructors can modify it to reflect their preferred style.
Appendix F, available in the E-Text, introduces common number systems used in
computing.
Fundamentals
1. Introduction
Object-Oriented Design
2. Fundamental
Data Types
3. Decisions
4. Loops
A gentle
introduction to recursion
5. Functions is optional.
Section 8.1
contains the core
material
6. Arrays
6. Iteration
and Vectors
Web Resources
This book is complemented by a complete suite of online resources. Go to www.wiley.
com/go/bclo3 to visit the online companion sites, which include
• Source code for all example programs in the book and its Worked Examples, plus
additional example programs.
• Worked Examples that apply the problem-solving steps in the book to other
realistic examples.
• Lecture presentation slides (for instructors only).
• Solutions to all review and programming exercises (for instructors only).
• A test bank that focuses on skills, not just terminology (for instructors only). This
extensive set of multiple-choice questions can be used with a word processor or
imported into a course management system.
• “CodeCheck” assignments that allow students to work on programming prob-
lems presented in an innovative online service and receive immediate feedback.
Instructors can assign exercises that have already been prepared, or easily add
their own. Visit http://codecheck.it to learn more.
EXAMPLE CODE See how_to_1/scores_vector in your companion code for a solution using vectors instead of arrays.
Walkthrough xi
These three
expressions should be related.
See Programming Tip 4.1.
The for loop neatly groups the initialization, condition, and update expressions
together. However, it is important to realize that these expressions are not executed
together (see Figure 3).
A recipe for a fruit pie may say to use any kind of fruit.
Here, “fruit” is an example of a parameter variable.
Apples and cherries are examples of arguments.
HOW TO 1.1
Describing an Algorithm with Pseudocode
This is the first of many “How To” sections in this book that give you step-by-step proce-
dures for carrying out important tasks in developing computer programs.
Before you are ready to write a program in C++, you need to develop an algorithm—a
method for arriving at a solution for a particular problem. Describe the algorithm in pseudo-
code––a sequence of precise steps formulated in English. To illustrate, we’ll devise an algo-
rithm for this problem:
How To guides give step-by-step
Problem Statement You have the choice of buying one guidance for common programming
of two cars. One is more fuel efficient than the other, but also
more expensive. You know the price and fuel efficiency (in miles tasks, emphasizing planning and
per gallon, mpg) of both cars. You plan to keep the car for ten
years. Assume a price of $4 per gallon of gas and usage of 15,000 testing. They answer the beginner’s
miles per year. You will pay cash for the car and not worry about
financing costs. Which car is the better deal? © dlewis33/Getty Images. question, “Now what do I do?” and
Step 1 Determine the inputs and outputs. integrate key concepts into a
In our sample problem, we have these inputs: problem-solving sequence.
• purchase price1 and fuel efficiency1, the price and fuel efficiency (in mpg) of the first car
• purchase price2 and fuel efficiency2, the price and fuel efficiency of the second car
Problem Statement Your task is to tile a rectangular bathroom floor with alternating Worked Examples apply
black and white tiles measuring 4 × 4 inches. The floor dimensions, measured in inches, are
multiples of 4. the steps in the How To to
Step 1 Determine the inputs and outputs.
a different example, showing
The inputs are the floor dimensions (length × width), how they can be used to
measured in inches. The output is a tiled floor.
Step 2 Break down the problem into smaller tasks.
plan, implement, and test
A natural subtask is to lay one row of tiles. If you can a solution to another
solve that task, then you can solve the problem by lay-
ing one row next to the other, starting from a wall, until programming problem.
you reach the opposite wall.
How do you lay a row? Start with a tile at one wall.
If it is Names
Table 3 Variable white, putin
a black
C++ one next to it. If it is black, put
a white one next to it. Keep going until you reach the
Variable Name wall. The row will contain width / 4 tiles.
opposite Comment © rban/iStockphoto.
1 Initialize counter
side_length = for (counter = 1; counter <= 10; counter++)
{
cout << counter << endl;
2 Initializing function parameter variable counter = 1 }
result1 =
double result1 = cube_volume(2);
2 Check condition
side_length = for (counter = 1; counter <= 10; counter++)
2
{
cout << counter << endl;
counter = 1 }
3 About to return to the caller result1 =
EXAMPLE CODE See sec04 of your companion code for another implementation of the earthquake program that you
Additional example programs
saw in Section 3.3. Note that the get_description function has multiple return statements.
are provided with the companion
code for students to read, run,
and modify.
xiv Walkthrough
For example, let’s trace the tax program with the data from the
more productive with tips and program run in Section 3.4. In lines 13 and 14, tax1 and tax2 are
Hand-tracing helps you
understand whether a
initialized to 0. program works correctly.
techniques such as hand-tracing. 6 int main()
7 {
8 const double RATE1 = 0.10; marital
9 const double RATE2 = 0.25; tax1 tax2 income status
10 const double RATE1_SINGLE_LIMIT = 32000;
11 const double RATE1_MARRIED_LIMIT = 64000; 0 0
12
13 double tax1 = 0;
14 double tax2 = 0;
15
In lines 18 and 22, income and marital_status are initialized by input statements.
16 double income;
17 cout << "Please enter your income: ";
18 cin >> income; marital
19 tax1 tax2 income status
20 cout << "Please enter s for single, m for married: ";
21 string marital_status; 0 0 80000 m
22 cin >> marital_status;
23
Special Topics present optional In each iteration of the loop, v is set to an element of the vector. Note that you do not use an
index variable. The value of v is the element, not the index of the element.
topics and provide additional If you want to modify elements, declare the loop variable as a reference:
for (int& v : values)
explanation of others. {
v++;
}
This loop increments all elements of the vector.
You can use the reserved word auto, which was introduced in Special Topic 2.3, for the type
of the element variable:
for (auto v : values) { cout << v << " "; }
The range-based for loop also works for arrays:
int primes[] = { 2, 3, 5, 7, 11, 13 };
for (int p : primes)
{
cout << p << " ";
}
Computing & Society 7.1 Embedded Systems The range-based for loop is a convenient shortcut for visiting or updating all elements of a
vector or an array. This book doesn’t use it because one can achieve the same result by looping
An embedded sys- would feel comfortable upgrading the duced in large volumes. Thus, the pro-
tem is a computer software in their washing machines grammer of an embedded system has
over index values. But if you like the more concise form, and use C++ 11 or later, you should
system that controls a device. The or automobile engines. If you ever a much larger economic incentive to certainly consider using it.
device contains a processor and other handed in a programming assignment conserve resources than the desktop
EXAMPLE CODE See special_topic_5 of your companion code for a program that demonstrates the range-based
hardware and is controlled by a com- that you believed to be correct, only to software programmer. Unfortunately, for loop.
puter program. Unlike a personal have the instructor or grader find bugs trying to conserve resources usually
computer, which has been designed in it, then you know how hard it is to makes it harder to write programs that
to be flexible and run many different write software that can reliably do its work correctly.
computer programs, the hardware task for many years without a chance C and C++ are commonly used
and software of an embedded system of changing it. Quality standards are languages for developing embedded
are tailored to a specific device. Com- especially important in devices whose systems.
puter controlled devices are becom- failure would destroy property or
ing increasingly common, ranging endanger human life. Many personal
from washing machines to medical computer purchasers buy computers Computing & Society presents social
equipment, cell phones, automobile that are fast and have a lot of stor-
engines, and spacecraft.
Several challenges are specific to
age, because the investment is paid
back over time when many programs
and historical topics on computing—for
programming embedded systems.
Most importantly, a much higher stan-
are run on the same equipment. But
the hardware for an embedded device
interest and to fulfill the “historical and
dard of quality control applies. Ven-
dors are often unconcerned about
is not shared––it is dedicated to one
device. A separate processor, memory,
social context” requirements of the
bugs in personal computer software,
because they can always make you
and so on, are built for every copy of
the device. If it is possible to shave a ACM/IEEE curriculum guidelines.
install a patch or upgrade to the next few pennies off the manufacturing © Courtesy of Professor Prabal Dutta.
version. But in an embedded system, cost of every unit, the savings can add
that is not an option. Few consumers up quickly for devices that are pro- The Controller of an Embedded System
Walkthrough xv
Acknowledgments
Many thanks to Don Fowley, Graig Donini, Dan Sayre, Ryann Dannelly, David
Dietz, Laura Abrams, and Billy Ray at John Wiley & Sons for their help with this
project. An especially deep acknowledgment and thanks goes to Cindy Johnson for
her hard work, sound judgment, and amazing attention to detail.
I am grateful to Mark Atkins, Ivy Technical College, Katie Livsie, Gaston College,
Larry Morell, Arkansas Tech University, and Rama Olson, Gaston College, for
their contributions to the supplemental material. Special thanks to Stephen Gilbert,
Orange Coast Community College, for his help with the interactive exercises.
Every new edition builds on the suggestions and experiences of new and prior
reviewers, contributors, and users. We are very grateful to the individuals who pro-
vided feedback, reviewed the manuscript, made valuable suggestions and contribu-
tions, and brought errors and omissions to my attention. They include:
Charles D. Allison, Utah Valley State College
Fred Annexstein, University of Cincinnati
Mark Atkins, Ivy Technical College
Stefano Basagni, Northeastern University
Noah D. Barnette, Virginia Tech
Susan Bickford, Tallahassee Community College
Ronald D. Bowman, University of Alabama, Huntsville
Robert Burton, Brigham Young University
Peter Breznay, University of Wisconsin, Green Bay
Richard Cacace, Pensacola Junior College, Pensacola
Kuang-Nan Chang, Eastern Kentucky University
Joseph DeLibero, Arizona State University
Subramaniam Dharmarajan, Arizona State University
Mary Dorf, University of Michigan
Marty Dulberg, North Carolina State University
William E. Duncan, Louisiana State University
John Estell, Ohio Northern University
Waleed Farag, Indiana University of Pennsylvania
Evan Gallagher, Polytechnic Institute of New York University
Stephen Gilbert, Orange Coast Community College
Kenneth Gitlitz, New Hampshire Technical Institute
Daniel Grigoletti, DeVry Institute of Technology, Tinley Park
Barbara Guillott, Louisiana State University
Charles Halsey, Richland College
Jon Hanrath, Illinois Institute of Technology
Neil Harrison, Utah Valley University
Jurgen Hecht, University of Ontario
Steve Hodges, Cabrillo College
xviii Acknowledgments
xix
Another random document with
no related content on Scribd:
The Project Gutenberg eBook of La retraite
ardente
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.
Language: French
La retraite ardente
ROMAN
DU MÊME AUTEUR
Chez le même éditeur :
Format in-18.