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

Brief C++: Late Objects, 3rd Edition

Visit to download the full and correct content document:


https://ebookmass.com/product/brief-c-late-objects-3rd-edition/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

C++20 for Programmers: An Objects-Natural Approach, 3rd


Edition Paul Deitel & Harvey Deitel

https://ebookmass.com/product/c20-for-programmers-an-objects-
natural-approach-3rd-edition-paul-deitel-harvey-deitel/

Data Structures and Other Objects Using C++ 4th Edition


Edition Michael Main

https://ebookmass.com/product/data-structures-and-other-objects-
using-c-4th-edition-edition-michael-main/

Beginning Java Objects: From Concepts to Code, 3rd


edition Jacquie Barker

https://ebookmass.com/product/beginning-java-objects-from-
concepts-to-code-3rd-edition-jacquie-barker/

Beginning Java Objects: From Concepts to Code 3rd


Edition Jacquie Barker

https://ebookmass.com/product/beginning-java-objects-from-
concepts-to-code-3rd-edition-jacquie-barker-2/
American Corrections in Brief 3rd Edition – Ebook PDF
Version

https://ebookmass.com/product/american-corrections-in-brief-3rd-
edition-ebook-pdf-version/

(eTextbook PDF) for American Corrections in Brief 3rd


Edition

https://ebookmass.com/product/etextbook-pdf-for-american-
corrections-in-brief-3rd-edition/

Starting Out with C++: From Control Structures through


Objects 8th Edition, (Ebook PDF)

https://ebookmass.com/product/starting-out-with-c-from-control-
structures-through-objects-8th-edition-ebook-pdf/

C++ How to Program: An Objects-Natural Approach, 11e


11th Edition Paul Deitel

https://ebookmass.com/product/c-how-to-program-an-objects-
natural-approach-11e-11th-edition-paul-deitel/

American Government: A Brief Introduction (Brief


Fifteenth Edition ) Brief

https://ebookmass.com/product/american-government-a-brief-
introduction-brief-fifteenth-edition-brief/
BriefC++
Cay Horstmann

Late Objects
3/e
vi Preface

• Selecting Test Cases


• Hand-Tracing
• Storyboards
• Solve a Simpler Problem First
• Reusable Functions
• Stepwise Refinement
• Adapting Algorithms
• Discovering Algorithms by Manipulating Physical Objects
• Draw a Picture (pointer diagrams)
• Tracing Objects (identifying state and behavior)
• Discovering Classes
A visual approach motivates the reader and eases navigation.
Photographs present visual analogies that explain
the nature and behavior of computer concepts.
Step-by-step figures illustrate complex program
operations. Syntax boxes and example tables pres-
ent a variety of typical and special cases in a com-
pact format. It is easy to get the “lay of the land” by
browsing the visuals, before focusing on the textual
material.
Focus on the essentials while being
© Terraxplorer/iStockphoto.
technically accurate.
An encyclopedic coverage is not helpful for a Visual features help the reader
beginning programmer, but neither is the oppo- with navigation.
site—reducing the material to a list of simplistic
bullet points. In this book, the essentials are presented in digestible chunks, with sep-
arate notes that go deeper into good practices or language features when the reader is
ready for the additional information. You will not find artificial over-simplifications
that give an illusion of knowledge.
Reinforce sound engineering practices.
A multitude of useful tips on software quality and common errors encourage the
development of good programming habits. The focus is on test-driven development,
encouraging students to test their programs systematically.
Engage with optional engineering and business exercises.
End-of-chapter exercises are enhanced with problems from scientific and business
domains. Designed to engage students, the exercises illustrate the value of program-
ming in applied fields.
Preface vii

New to This Edition


Updated for Modern Versions of C++
A number of features of the C++ 2011 and C++ 2014 standards are described either as
recommended “best practice” or as Special Topics.

New and Reorganized Topics


The book now supports two pathways into object-oriented programming and inher-
itance. Pointers and structures can be covered before introducing classes. Alterna-
tively, pointers can be deferred until after the implementation of classes.
A sequence of Worked Examples and exercises introduces “media computa-
tion”—generating and modifying images, sounds, and animations.

Lower-Cost, Interactive Format


This third edition is published as a lower-cost Enhanced E-Text that supports active
learning through a wealth of interactive activities. These activities engage and prepare
students for independent programming and the Review Exercises, Practice Exercises,
and Programming Projects at the end of each E-Text chapter. The Enhanced E-Text
may also be bundled with an Abridged Print Companion, which is a bound book that
contains the entire text for reference, but without exercises or practice material.
Interactive learning solutions are expanding every day, so to learn more about
these options or to explore other options to suit your needs, please contact your
Wiley account manager (www.wiley.com/go/whosmyrep) or visit the product information
page for this text on wiley.com (http://wiley.com/college/sc/horstmann).
The Enhanced E-Text is designed to enable student practice without the instructor
assigning the interactivities or recording their scores. If you are interested in assign-
ing and grading students’ work on them, ask your Wiley Account Manager about the
online course option implemented in the Engage Learning Management System. The
Engage course supports the assignment and automatic grading of the interactivities.
Engage access includes access to the Enhanced E-Text.

Features in the Enhanced E-Text


The interactive Enhanced E-Text guides students from the basics to writing complex
pro­grams. After they read a bit, they can try all of the interactive exercises for that
section. Active reading is an engaging way for students to ensure that students are
prepared before going to class.
There five types of interactivities:
Code Walkthrough Code Walkthrough activities ask students to trace through a
segment of code, choosing which line will be executed next and entering the new
values of variables changed by the code’s execution. This activity simulates the hand-
tracing problem solving technique taught in Chapters 3 and 4—but with immediate
feedback.
viii 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.

A Tour of the Book


This book is intended for a two-semester introduction to programming that may also
include algorithms and data structures. The organization of chapters offers the same
flexibility as the previous edition; dependencies among the chapters are also shown
in Figure 1.

Part A: Fundamentals (Chapters 1–8)


The first six chapters follow a traditional approach to basic programming concepts.
Students learn about control structures, stepwise refinement, and arrays. Objects are
used only for input/output and string processing. Input/output is first covered in
Chapter 2, which may be followed by an introduction to reading and writing text
files in Section 8.1.
In a course for engineers with a need for systems and embedded programming,
you will want to cover Chapter 7 on pointers. Sections 7.1 and 7.4 are sufficient for
using pointers with polymorphism in Chapter 10.
File processing is the subject of Chapter 8. Section 8.1 can be covered sooner for
an intro­duction to reading and writing text files. The remainder of the chapter gives
addi­tional material for practical applications.
Preface ix

Part B: Object-Oriented Design (Chapters 9–10)


After students have gained a solid foundation, they are ready to tackle the implemen-
tation of classes. Chapters 9 and 10 introduce the object-oriented features of C++.
Chapter 9 introduces class design and implementation. Chapter 10 covers inheritance
and polymorphism. By the end of these chapters, students will be able to implement
programs with multiple interacting classes.
Any subset of these chapters can be incorporated into a custom print version of
this text; ask your Wiley sales representative for details, or visit customselect.wiley.com
to create your custom order.

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

7. Pointers 8. Streams 9. Classes

Sections 10. Inheritance


7.1 and 7.4 are
required

Figure 1 Chapter Dependencies


x Preface

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.

Pointers in the print


companion describe what
students will find in their WORKED EXAMPLE 2.1
Computing Travel Time
E-Text or online.
Learn how to develop a hand calculation to compute the time that
a robot requires to retrieve an item from rocky terrain. See your
.
E-Text or visit wiley.com/go/bclo3
Courtesy of NASA.

EXAMPLE CODE See how_to_1/scores_vector in your companion code for a solution using vectors instead of arrays.
Walkthrough xi

A Walkthrough of the Learning Aids


The pedagogical elements in this book work together to focus on and reinforce key
concepts and fundamental principles of programming, with additional tips and detail
organized to support and deepen these fundamentals. In addition to traditional
features, such as chapter objectives and a wealth of exercises, each chapter contains
elements geared to today’s visual learner.

106 Chapter 4 Loops

4.3 The for Loop


Throughout each chapter,
It often happens that you want to execute a sequence of
margin notes show where The for loop is
used when a statements a given number of times. You can use a while
value runs from a loop that is controlled by a counter, as in the following
new concepts are introduced starting point to an
ending point with a
example:
and provide an outline of key ideas. constant increment
or decrement.
counter = 1; // Initialize the counter
while (counter <= 10) // Check the counter
{
cout << counter << endl;
counter++; // Update the counter
}

Because this loop type is so common, there is a special


form for it, called the for loop (see Syntax 4.2).
for (counter = 1; counter <= 10; counter++)
{
© Enrico Fianchini/iStockphoto.
cout << counter << endl;
}
You can visualize the
Some people call this loop count-controlled. In contrast, for loop as an orderly
the while loop of the preceding section can be called an sequence of steps.
event-controlled loop because it executes until an event
occurs (for example, when the balance reaches the target). Another commonly-used
Annotated syntax boxes term for a count-controlled loop is definite. You know from the outset that the loop
body will be executed a definite number of times––ten times in our example. In con-
provide a quick, visual overview trast, you do not know how many iterations it takes to accumulate a target balance.
Such a loop is called indefinite.
of new language constructs.
Syntax 4.2 for Statement

These three
expressions should be related.
See Programming Tip 4.1.

Annotations explain This initialization The loop is This update is


required components happens once
before the loop starts.
executed while
this condition is true.
executed after
each iteration.
and point to more information for (int i = 5; i <= 10; i++)

on common errors or best practices The variable i is


{
sum = sum + i;
This loop executes 6 times.
associated with the syntax. defined only in this
for loop.
}
See Programming Tip 4.3.

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).

Analogies to everyday objects are


used to explain the nature and behavior
of concepts such as variables, data
Like a variable in a computer types, loops, and more.
program, a parking space has
an identifier and contents.
xii Walkthrough

Memorable photos reinforce


analogies and help students
remember the concepts. pie(fruit) pie(fruit)

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.

Problem Solving sections teach


techniques for generating ideas and
6.5 Problem Solving: Discovering Algorithms by Manipulating Physical Objects 277
evaluating proposed solutions, often
using pencil and paper or other Now how does that help us with our problem, switching the first and the second
half of the array?
artifacts. These sections emphasize Let’s put the first coin into place, by swapping it with the fifth coin. However, as
C++ programmers, we will say that we swap the coins in positions 0 and 4:
that most of the planning and problem
solving that makes students successful
happens away from the computer.

Next, we swap the coins in positions 1 and 5:

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

WORKED EXAMPLE 1.1


Writing an Algorithm for Tiling a Floor

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.

Step 3 Describe each subtask in pseudocode.


can_volume1 Variable names consist of letters, numbers, and the underscore
character.
x In mathematics, you use short variable names such as x or y. This is
legal in C++, but not very common, because it can make programs
harder to understand (see Programming Tip 2.1). Example tables support beginners
!
Can_volume Caution: Variable names are case sensitive. This variable name is with multiple, concrete examples.
different from can_volume.
These tables point out common
6pack Error: Variable names cannot start with a number.

can volume Error: Variable names cannot contain spaces.


errors and present another quick
double Error: You cannot use a reserved word as a variable name. reference to the section’s topic.
ltr/fl.oz Error: You cannot use symbols such as . or /
Walkthrough xiii

Consider the function call illustrated in Figure 3:


double result1 = cube_volume(2); Progressive figures trace code
• The parameter variable side_length of the cube_volume function is created. ❶
• The parameter variable is initialized with the value of the argument that was
segments to help students visualize
passed in the call. In our case, side_length is set to 2. ❷ the program flow. Color is used
• The function computes the expression side_length * side_length * side_length,
which has the value 8. That value is stored in the variable volume. ❸ consistently to make variables and
• The function returns. All of its variables are removed. The return value is trans-
ferred to the caller, that is, the function calling the cube_volume function. ❹
other elements easily recognizable.

1 Function call result1 =


double result1 = cube_volume(2);

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 =

3 Execute loop body


for (counter = 1; counter <= 10; counter++)
side_length = 2 {
double volume = side_length * side_length * side_length;
return volume; cout << counter << endl;
volume = 8 counter = 1 }

4 After function call result1 = 8 4 Update counter


for (counter = 1; counter <= 10; counter++)
double result1 = cube_volume(2); {
cout << counter << endl;
counter = 2 }
Figure 3 Parameter Passing

5 Check condition again


for (counter = 1; counter <= 10; counter++)
{
cout << counter << endl;
counter = 2 }

Figure 3 Execution of a for Loop


Optional engineering exercises
engage students with applications
from technical fields. Engineering P7.12 Write a program that simulates the control
software for a “people mover” system, a set of
driverless trains that move in two concentric
circular tracks. A set of switches allows trains
to switch tracks.
In your program, the outer and inner tracks
should each be divided into ten segments.
Each track segment can contain a train that
moves either clockwise or counterclockwise.
sec02/cube.cpp A train moves to an adjacent segment in its track or, if that segment is occupied, to
the adjacent segment in the other track.
1 #include <iostream>
2 Define a Segment structure. Each segment has a pointer to the next and previous
3 using namespace std; segments in its track, a pointer to the next and previous segments in the other track,
4
5 /**
6 Computes the volume of a cube.
7 @param side_length the side length of the cube
8 @return the volume
9 */
10 double cube_volume(double side_length)
11 {
12 double volume = side_length * side_length * side_length;
13 return volume;
14 }
15
16 int main()
Program listings are carefully
17
18
{
double result1 = cube_volume(2); designed for easy reading,
double result2 = cube_volume(10);
19
20 cout << "A cube with side length 2 has volume " << result1 << endl; going well beyond simple
21 cout << "A cube with side length 10 has volume " << result2 << endl;
22 color coding. Functions are set
23 return 0;
24 } off by a subtle outline.
Program Run
A cube with side length 2 has volume 8
A cube with side length 10 has volume 1000

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

Common Errors describe the kinds Common Error 2.1


Using Undefined Variables
of errors that students often make, You must define a variable before you use it for the first time. For example, the following
with an explanation of why the errors sequence of statements would not be legal:
double can_volume = 12 * liter_per_ounce;
occur, and what to do about them. double liter_per_ounce = 0.0296;
In your program, the statements are compiled in order. When the compiler reaches the first
statement, it does not know that liter_per_ounce will be defined in the next line, and it reports
an error.

Programming Tip 3.6


Hand-Tracing
A very useful technique for understanding whether a program
works correctly is called hand-tracing. You simulate the pro-
gram’s activity on a sheet of paper. You can use this method with
pseudocode or C++ code.
Get an index card, a cocktail napkin, or whatever sheet of
Programming Tips explain paper is within reach. Make a column for each variable. Have the
program code ready. Use a marker, such as a paper clip, to mark
good programming practices, the current statement. In your mind, execute statements one at a
time. Every time the value of a variable changes, cross out the old
and encourage students to be value and write the new value below the old one.
© thomasd007/iStockphoto.

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

Because marital_status is not "s", we move to the else


branch of the outer if statement (line 36).
24 if (marital_status == "s")
25 {
26 if (income <= RATE1_SINGLE_LIMIT)
27
28
{ Special Topic 6.5
tax1 = RATE1 * income;
29
30
}
else The Range-Based for Loop
31 {
32 C++ 11 introduces a convenient syntax for visiting all elements in a “range” or sequence of ele-
tax1 = RATE1 * RATE1_SINGLE_LIMIT;
ments. This loop displays all elements in a vector:
vector<int> values = {1, 4, 9, 16, 25, 36};
for (int v : values)
{
cout << v << " ";
}

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

Interactive activities in the E-Text


engage students in active reading as they…

Trace through a code segment

Build an example table

Explore common algorithms

Arrange code to fulfill a task

Complete a program and Create a memory diagram


get immediate feedback
Acknowledgments xvii

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

Jackie Jarboe, Boise State University


Debbie Kaneko, Old Dominion University
Mir Behrad Khamesee, University of Waterloo
Sung-Sik Kwon, North Carolina Central University
Lorrie Lehman, University of North Carolina, Charlotte
Cynthia Lester, Tuskegee University
Yanjun Li, Fordham University
W. James MacLean, University of Toronto
LindaLee Massoud, Mott Community College
Adelaida Medlock, Drexel University
Charles W. Mellard, DeVry Institute of Technology, Irving
Larry Morell, Arkansas Tech University
Ethan V. Munson, University of Wisconsin, Milwaukee
Arun Ravindran, University of North Carolina at Charlotte
Philip Regalbuto, Trident Technical College
Don Retzlaff, University of North Texas
Jeff Ringenberg, University of Michigan, Ann Arbor
John P. Russo, Wentworth Institute of Technology
Kurt Schmidt, Drexel University
Brent Seales, University of Kentucky
William Shay, University of Wisconsin, Green Bay
Michele A. Starkey, Mount Saint Mary College
William Stockwell, University of Central Oklahoma
Jonathan Tolstedt, North Dakota State University
Boyd Trolinger, Butte College
Muharrem Uyar, City College of New York
Mahendra Velauthapillai, Georgetown University
Kerstin Voigt, California State University, San Bernardino
David P. Voorhees, Le Moyne College
Salih Yurttas, Texas A&M University

A special thank you to all of our class testers:


Pani Chakrapani and the students of the University of Redlands
Jim Mackowiak and the students of Long Beach City College, LAC
Suresh Muknahallipatna and the students of the University of Wyoming
Murlidharan Nair and the students of the Indiana University of South Bend
Harriette Roadman and the students of New River Community College
David Topham and the students of Ohlone College
Dennie Van Tassel and the students of Gavilan College
CONTENTS
PREFACE v CE2 Using Uninitialized Variables 33
SPECIAL FEATURES xxiv PT1 Choose Descriptive Variable Names 33
PT2 Do Not Use Magic Numbers 34
QUICK REFERENCE xxviii
ST1 Numeric Types in C++ 34
ST2 Numeric Ranges and Precisions 35
1 INTRODUCTION 1 ST3 Defining Variables with auto 35

1.1 What Is Programming?   2 2.2 Arithmetic  36


Arithmetic Operators  36
1.2 The Anatomy of a Computer   3
Increment and Decrement   36
C&S Computers Are Everywhere 5
Integer Division and Remainder   36
1.3 Machine Code and Programming Converting Floating-Point Numbers to
Languages  5 Integers  37
C&S Standards Organizations 7 Powers and Roots   38
CE3 Unintended Integer Division 39
1.4 Becoming Familiar with Your
CE4 Unbalanced Parentheses 40
Programming Environment   7
CE5 Forgetting Header Files 40
PT1 Backup Copies 10
CE6 Roundoff Errors 41
1.5 Analyzing Your First Program   11
PT3 Spaces in Expressions 42
CE1 Omitting Semicolons 13
ST4 Casts 42
ST1 Escape Sequences 13
ST5 Combining Assignment and Arithmetic 42
1.6 Errors  14 C&S The Pentium Floating-Point Bug 43
CE2 Misspelling Words 15
2.3 Input and Output   44
1.7 PROBLEM SOLVING Algorithm Design   16 Input  44
The Algorithm Concept   16 Formatted Output  45
An Algorithm for Solving an Investment
Problem  17
2.4 PROBLEM SOLVING First Do It By Hand   47
Pseudocode  18 WE1 Computing Travel Time 48
From Algorithms to Programs   19 HT1 Carrying out Computations 48
HT1 Describing an Algorithm with WE2 Computing the Cost of Stamps 51
Pseudocode 19 2.5 Strings  51
WE1 Writing an Algorithm for Tiling a Floor 21 The string Type  51
Concatenation  52
2 FUNDAMENTAL DATA String Input  52
String Functions  52
TYPES 25
C&S International Alphabets and Unicode 55
2.1 Variables  26
Variable Definitions  26 3 DECISIONS 59
Number Types  28
Variable Names    29 3.1 The if Statement   60
The Assignment Statement   30 CE1 A Semicolon After the if Condition 63
Constants  31 PT1 Brace Layout 63
Comments  31
PT2 Always Use Braces 64
CE1 Using Undefined Variables 33
PT3 Tabs 64

xix
xx Contents

PT4 Avoid Duplication in Branches 65 4.4 The do Loop   111


ST1 The Conditional Operator 65 PT4 Flowcharts for Loops 111
3.2 Comparing Numbers and Strings   66 4.5 Processing Input   112
CE2 Confusing = and == 68 Sentinel Values  112
CE3 Exact Comparison of Floating-Point Reading Until Input Fails   114
Numbers 68 ST1 Clearing the Failure State 115
PT5 Compile with Zero Warnings 69 ST2 The Loop-and-a-Half Problem and the
ST2 Lexicographic Ordering of Strings 69 break Statement 116
HT1 Implementing an if Statement 70 ST3 Redirection of Input and Output 116
WE1 Extracting the Middle 72 4.6 PROBLEM SOLVING Storyboards  117
C&S Dysfunctional Computerized Systems 72
4.7 Common Loop Algorithms   119
3.3 Multiple Alternatives   73
Sum and Average Value   119
ST3 The switch Statement 75 Counting Matches  120
3.4 Nested Branches   76 Finding the First Match   120
CE4 The Dangling else Problem 79 Prompting Until a Match is Found   121
PT6 Hand-Tracing 79 Maximum and Minimum   121
Comparing Adjacent Values   122
3.5 PROBLEM SOLVING Flowcharts  81
HT1 Writing a Loop 123
3.6 PROBLEM SOLVING Test Cases   83 WE1 Credit Card Processing 126
PT7 Make a Schedule and Make Time for
Unexpected Problems 84 4.8 Nested Loops   126
WE2 Manipulating the Pixels in an Image 129
3.7 Boolean Variables and Operators   85
CE5 Combining Multiple Relational Operators 88
4.9 PROBLEM SOLVING Solve a Simpler
CE6 Confusing && and || Conditions 88
Problem First   130
ST4 Short-Circuit Evaluation of Boolean 4.10 Random Numbers and Simulations   134
Operators 89 Generating Random Numbers   134
ST5 De Morgan’s Law 89 Simulating Die Tosses   135
3.8 APPLICATION Input Validation   90 The Monte Carlo Method   136
C&S Artificial Intelligence 92 C&S Digital Piracy 138

4 LOOPS 95 5 FUNCTIONS 141

4.1 The while Loop   96 5.1 Functions as Black Boxes   142


CE1 Infinite Loops 100 5.2 Implementing Functions   143
CE2 Don’t Think “Are We There Yet?” 101 PT1 Function Comments 146
CE3 Off-by-One Errors 101 5.3 Parameter Passing   146
C&S The First Bug 102 PT2 Do Not Modify Parameter Variables 148
4.2 PROBLEM SOLVING Hand-Tracing  103 5.4 Return Values   148
4.3 The for Loop   106 CE1 Missing Return Value 149
PT1 Use for Loops for Their Intended ST1 Function Declarations 150
Purpose Only 109 HT1 Implementing a Function 151
PT2 Choose Loop Bounds That Match WE1 Generating Random Passwords 152
Your Task 110 WE2 Using a Debugger 152
PT3 Count Iterations 110
5.5 Functions Without Return Values   153
Contents xxi

5.6 PROBLEM SOLVING Reusable Functions   154 6.4 PROBLEM SOLVING Adapting
5.7 PROBLEM SOLVING Stepwise Algorithms  198
Refinement  156 HT1 Working with Arrays 200

PT3 Keep Functions Short 161 WE1 Rolling the Dice 203

PT4 Tracing Functions 161 6.5 PROBLEM SOLVING Discovering Algorithms by


PT5 Stubs 162 Manipulating Physical Objects   203
WE3 Calculating a Course Grade 163 6.6 Two-Dimensional Arrays   206
5.8 Variable Scope and Global Variables   163 Defining Two-Dimensional Arrays   207
PT6 Avoid Global Variables 165 Accessing Elements  207
5.9 Reference Parameters   165 Locating Neighboring Elements   208
Computing Row and Column Totals   208
PT7 Prefer Return Values to Reference
Parameters 169 Two-Dimensional Array Parameters   210
CE2 Omitting the Column Size of a Two-
ST2 Constant References 170
Dimensional Array Parameter 212
5.10 Recursive Functions (Optional)   170 WE2 A World Population Table 213
HT2 Thinking Recursively 173
6.7 Vectors  213
C&S The Explosive Growth of Personal
Computers 174 Defining Vectors  214
Growing and Shrinking Vectors   215
Vectors and Functions   216
6 ARRAYS AND VECTORS 179 Vector Algorithms  216
Two-Dimensional Vectors  218
6.1 Arrays  180
PT2 Prefer Vectors over Arrays 219
Defining Arrays  180 ST5 The Range-Based for Loop 219
Accessing Array Elements   182
Partially Filled Arrays   183
CE1 Bounds Errors 184 7 POINTERS AND
PT1 Use Arrays for Sequences of Related STRUCTURES 223
Values 184
C&S Computer Viruses 185 7.1 Defining and Using Pointers   224
Defining Pointers  224
6.2 Common Array Algorithms   185
Accessing Variables Through Pointers   225
Filling  186 Initializing Pointers  227
Copying   186
CE1 Confusing Pointers with the Data to Which
Sum and Average Value   186 They Point 228
Maximum and Minimum   187
PT1 Use a Separate Definition for Each Pointer
Element Separators  187 Variable 229
Counting Matches  187
ST1 Pointers and References 229
Linear Search  188
Removing an Element   188 7.2 Arrays and Pointers   230
Inserting an Element   189 Arrays as Pointers    230
Swapping Elements  190 Pointer Arithmetic  230
Reading Input  191 Array Parameter Variables Are Pointers   232
ST1 Sorting with the C++ Library 192 ST2 Using a Pointer to Step Through
ST2 A Sorting Algorithm 192 an Array 233
ST3 Binary Search 193 CE2 Returning a Pointer to a Local Variable 234
PT2 Program Clearly, Not Cleverly 234
6.3 Arrays and Functions   194
ST3 Constant Pointers 235
ST4 Constant Array Parameters 198
xxii Contents

7.3 C and C++ Strings   235 8.5 Command Line Arguments   274
The char Type  235 C&S Encryption Algorithms 277
C Strings  236 HT1 Processing Text Files 278
Character Arrays  237 WE1 Looking for for Duplicates 281
Converting Between C and C++ Strings   237
8.6 Random Access and Binary Files   281
C++ Strings and the [] Operator  238
Random Access  281
ST4 Working with C Strings 238
Binary Files  282
7.4 Dynamic Memory Allocation   240 Processing Image Files   282
CE3 Dangling Pointers 242 C&S Databases and Privacy 286
CE4 Memory Leaks 243

7.5 Arrays and Vectors of Pointers   243 9 CLASSES 289


7.6 PROBLEM SOLVING Draw a Picture   246
HT1 Working with Pointers 248 9.1 Object-Oriented Programming   290
WE1 Producing a Mass Mailing 249 9.2 Implementing a Simple Class   292
C&S Embedded Systems 250 9.3 Specifying the Public Interface of
7.7 Structures  250 a Class   294
Structured Types  250 CE1 Forgetting a Semicolon 296
Structure Assignment and Comparison   251 9.4 Designing the Data Representation   297
Functions and Structures   252
9.5 Member Functions   299
Arrays of Structures   252
Structures with Array Members   253 Implementing Member Functions   299
Nested Structures  253 Implicit and Explicit Parameters   299
Calling a Member Function from a
7.8 Pointers and Structures   254 Member Function  301
Pointers to Structures   254 PT1 All Data Members Should Be Private; Most
Structures with Pointer Members   255 Member Functions Should Be Public 303
ST5 Smart Pointers 256 PT2 const Correctness 303

9.6 Constructors  304
8 STREAMS 259 CE2 Trying to Call a Constructor 306
ST1 Overloading 306
8.1 Reading and Writing Text Files   260 ST2 Initializer Lists 307
Opening a Stream   260 ST3 Universal and Uniform Initialization
Reading from a File   261 Syntax 308
Writing to a File   262
9.7 PROBLEM SOLVING Tracing Objects   308
A File Processing Example   262
HT1 Implementing a Class 310
8.2 Reading Text Input   265 WE1 Implementing a Bank Account Class 314
Reading Words  265 C&S Electronic Voting Machines 314
Reading Characters  266
9.8 PROBLEM SOLVING Discovering
Reading Lines  267
Classes  315
CE1 Mixing >> and getline Input 268
PT3 Make Parallel Vectors into Vectors of
ST1 Stream Failure Checking 269
Objects 317
8.3 Writing Text Output   270
9.9 Separate Compilation   318
ST2 Unicode, UTF-8, and C++ Strings 272
9.10 Pointers to Objects   322
8.4 Parsing and Formatting Strings   273
Dynamically Allocating Objects   322
The -> Operator  323
The this Pointer  324
Contents xxiii

9.11 PROBLEM SOLVING Patterns for Appendix A RESERVED WORD SUMMARY   A-1
Object Data   324 Appendix B OPERATOR SUMMARY  A-3
Keeping a Total   324 Appendix C CHARACTER CODES  A-5
Counting Events  325
Appendix D C++ LIBRARY SUMMARY   A-8
Collecting Values  326
Managing Properties of an Object   326 Appendix E C++ LANGUAGE CODING
Modeling Objects with Distinct States   327 GUIDELINES  A-11
Describing the Position of an Object   328 Appendix F NUMBER SYSTEMS AND BIT AND SHIFT
C&S Open Source and Free Software 329 OPERATIONS (E-TEXT ONLY)

10 INHERITANCE 333 GLOSSARY  G-1


INDEX  I-1
10.1 Inheritance Hierarchies   334 CREDITS  C-1
10.2 Implementing Derived Classes   338
CE1 Private Inheritance 341
CE2 Replicating Base-Class Members 341
PT1 Use a Single Class for Variation in Values,
ALPHABETICAL LIST OF SYNTAX BOXES
Inheritance for Variation in Behavior 342 Assignment  30
ST1 Calling the Base-Class Constructor 342 C++ Program  12
10.3 Overriding Member Functions   343 Class Definition   295
Comparisons  67
CE3 Forgetting the Base-Class Name 345
Constructor with Base-Class Initializer   342
10.4 Virtual Functions and Polymorphism   346 Defining an Array   181
The Slicing Problem   346 Defining a Structure   251
Pointers to Base and Derived Classes   347 Defining a Vector   213
Virtual Functions  348 Derived-Class Definition  340
Polymorphism  349 Dynamic Memory Allocation   240
PT2 Don’t Use Type Tags 352 for Statement  106
CE4 Slicing an Object 352 Function Definition  145
CE5 Failing to Override a Virtual Function 353 if Statement  61
ST2 Virtual Self-Calls 354 Input Statement  44
HT1 Developing an Inheritance Hierarchy 354 Member Function Definition   301
WE1 Implementing an Employee Hierarchy for Output Statement  13
Payroll Processing 359
Pointer Syntax  226
C&S Who Controls the Internet? 360
Two-Dimensional Array Definition   207
Variable Definition  27
while Statement  97
Working with File Streams   262
xxiv Special Features

How Tos
C H AP TE R Common and
Errors
Worked Examples
© Steve Simzer/iStockphoto.

© Tom Horyn/iStockphoto.

1 Introduction © Scott Harms/iStockphoto.


Omitting Semicolons 13 Describing an Algorithm
Misspelling Words 15 with Pseudocode 19
Writing an Algorithm for
Tiling a Floor 21

2 Fundamental Using Undefined Variables 33 Computing Travel Time 48


Using Uninitialized Variables 33 Carrying out Computations 48
Data Types
Unintended Integer Division 39 Computing the Cost of Stamps 51
Unbalanced Parentheses 40
Forgetting Header Files 40
Roundoff Errors 41

3 Decisions A Semicolon After the if Implementing an if Statement 70


Condition 63 Extracting the Middle 72
Confusing = and == 68
Exact Comparison of
Floating-Point Numbers 68
The Dangling else Problem 79
Combining Multiple
Relational Operators 88
Confusing && and || Conditions 88

4 Loops Infinite Loops 100 Writing a Loop 123


Don’t Think “Are We There Yet?” 101 Credit Card Processing 126
Off-by-One Errors 101 Manipulating the Pixels
in an Image 129

5 Functions Missing Return Value 149 Implementing a Function 151


Generating Random Passwords 152
Using a Debugger 152
Calculating a Course Grade 163
Thinking Recursively 173
Another random document with
no related content on Scribd:
et poussiéreuses. Au coin d’un maigre feu, un petit vieillard, aux
jambes enveloppées dans une couverture, était établi.
Reconnaissant son neveu, il parut effaré.
— Alors vous voilà, mon pauvre garçon ! Je vous plains bien… je
vous plains bien… gémit-il.
— De quoi, mon oncle ? demanda M. Aubil étonné.
— De Mathilde, reprit le vieux, de sa voix aigre et d’un air
peureux. — De Mathilde… Elle est terrible, hein ?… Ils sont venus
tous me raconter… Elle leur en a fait… elle leur en a fait… Tous ont
peur… tous… Et moi aussi… Alors, hein, allez-vous-en, Aubil, allez-
vous-en, voulez-vous ?… Elle pourrait venir vous chercher ici… Je
vous plains bien, mais allez-vous-en tout de suite…
« C’est un vieux fou », se dit M. Aubil lorsqu’il se retrouva dans la
rue. Mais il était extrêmement mortifié et, le soir, en retrouvant
Mathilde, il lui expliqua, avec quelques atténuations, que l’oncle
Armand, qui n’avait plus sa tête à lui, l’avait mis à la porte.
Mathilde bondit, elle jeta sur son mari un regard d’indicible
reproche.
— Tu t’es brouillé avec l’oncle Armand, articula-t-elle lentement,
tu t’es brouillé avec l’oncle Armand… Et tu viendras encore dire,
n’est-ce pas, que c’est moi qui ai mauvais caractère !…
LE VIEIL AMI

M. et Mme Pougues, après avoir amassé une modeste fortune


dans le commerce de la papeterie au détail, avaient réalisé le rêve
caressé pendant trente années de travail acharné et de privations
farouches : ils s’étaient retirés dans un petit pavillon entouré d’un
petit jardin au fond de Vaugirard. Satisfaits, ils y vivaient dans un
égoïsme vigilant, préoccupés seulement de profiter au mieux de
leurs rentes et d’économiser tout le long de l’année pour le séjour
qu’ils faisaient chaque été, depuis six ans qu’ils étaient libres, dans
la même plage tranquille et peu fréquentée des côtes de l’Océan.
Là, ils déployaient quelque faste. Mme Pougues, encore jeune
d’allures, arborait des mousselines à rayures éclatantes et des
bérets crânement enfoncés ; affable et hautaine, elle jouait à la dame
riche auprès de sa propriétaire et auprès des fournisseurs, chez
lesquels elle causait complaisamment, tout en marchandant avec
âpreté. M. Pougues brillait au Café de la Place. Les habitués, qui se
recrutaient parmi les personnages importants de la ville, l’avaient en
haute estime. Lorsque, vers cinq heures, majestueux, malgré sa
petite stature étriquée, il venait s’installer à sa table préférée, un
cercle se formait autour de lui. Il avait de l’éloquence et parlait de
tout avec l’autorité d’un homme qui a brassé de grosses affaires et
qui fréquente intimement, à Paris, les plus hautes personnalités. Ses
opinions sur la guerre faisaient loi et ses vues sur l’avenir du
commerce français émerveillaient ses auditeurs. En outre, il jouait
parfaitement aux dominos, ce qui augmentait son prestige.
Un soir, au moment où M. Pougues franchissait la porte
principale du café, par une porte adjacente un autre personnage
entra. C’était un vieux monsieur de haute taille et de belle prestance,
coiffé d’un canotier et élégamment vêtu de blanc, de la tête aux
pieds. Sa belle barbe grise descendait avec noblesse sur sa large
poitrine et sa face colorée exprimait la joie de vivre. Il vit Pougues et
fit un mouvement de surprise :
— Me trompé-je ?… Suis-je le jouet d’une ressemblance ?… M.
Pougues, n’est-ce pas ? C’est à M. Pougues, ancien négociant, que
j’ai l’honneur ?… Vous me reconnaissez, j’espère : Buvat, Arsène
Buvat… Heureuse rencontre ! Je suis ravi !…
Sa voix de basse taille emplissait le café. Il avait pris les mains
de M. Pougues et les serrait. M. Pougues, un peu effaré, n’arrivait
pas à le reconnaître, malgré une vague impression lointaine qu’il
l’avait déjà vu. Ce nom : Buvat, ne lui disait rien. Toutefois, la tenue
élégante de son interlocuteur, l’aisance de ses manières, le terme de
négociant dont il s’était servi à son égard avaient séduit M. Pougues.
Il répondit avec cordialité aux effusions de M. Buvat, l’invita à
s’asseoir et lui présenta les habitués, qui avaient assisté à la scène
avec beaucoup d’intérêt.
— Heureuse rencontre, reprit Buvat, quand il eut vidé son verre
d’un seul trait. Mon cher Pougues, je suis ravi… Et vous êtes ici
depuis une semaine ? Bizarre qu’on ne se soit pas encore vus…
Enfin, nous nous rattraperons, puisque vous restez toute la saison et
que moi je reste toute l’année. Toute l’année, parfaitement ! Ça vous
étonne d’un vieux Parisien comme moi… Que voulez-vous, au fond,
moi, je suis l’homme de la nature. Ah ! la mer… la mer !… Alors,
quand j’ai hérité… Oui, un héritage qui m’est tombé du ciel,
récemment. Un vieux cousin de Poitiers que je n’avais jamais vu…
Ça m’a décidé… Il y avait deux maisons. J’ai vendu celle de Poitiers,
j’ai gardé celle d’ici, où je me suis installé. Cottage Tout mon Rêve, à
l’entrée de la forêt. Vous viendrez m’y voir.
— Charmante habitation, constata le patron du café.
— Logeable, logeable… Et vous, Pougues, Paris vous tient
toujours ? Toujours des affaires, sans doute, d’importantes
entreprises dont vous vous occupez encore, malgré votre retraite…
Ah ! quand on a été lancé pendant trente ans dans le tourbillon…
Mais vous avez tort… Ménagez-vous, mon cher ! Vous devriez faire
comme moi… Vous fixer ici… Mais nos verres sont vides…
Messieurs, que prenez-vous ?… Permettez-moi… ce sera à la santé
de notre ami…
Un soleil de vanité avait incendié le petit visage bilieux de M.
Pougues, que l’on considérait avec un respect accru. M. Buvat
continuait ses discours qu’il émaillait de bons mots. Quand on
apporta les dominos, il accepta d’y jouer et se révéla un maître
étourdissant. Une admiration s’élevait autour de lui et rejaillissait sur
M. Pougues. Lorsque celui-ci, surexcité par trop de consommations,
qu’il avait bues sans s’en apercevoir, sortit fièrement du café au bras
de cet homme décoratif, il était persuadé de l’avoir toujours eu pour
plus intime ami, et il insista pour l’emmener dîner chez lui le soir
même. Buvat accepta sans façons.
Mme Pougues, soucieuse d’être la maîtresse de maison
accomplie, et que rien ne désarçonne, accueillit ces messieurs avec
beaucoup d’affabilité. Cependant, bien que M. Buvat se soit précipité
vers elle avec l’effusion d’une vieille connaissance, elle ne réussit,
pas plus que M. Pougues, à se rappeler nettement de lui.
Le dîner fut bon et le vin excellent, car M. Pougues se piquait
d’être amateur. M. Buvat enchantait ses hôtes par une verve
croissante. Au dessert, il s’attendrit. Après le café, quand il eut avalé
négligemment deux ou trois verres de cognac et allumé un cigare, il
s’accouda carrément sur la table. Alors, tournant vers M. Pougues
ses gros yeux un peu troublés, il dit soudain avec affection :
— J’ai été gentil, ce tantôt, pas vrai, mon vieux Pougues ? Je
vous ai fait un peu mousser… Pour une fois, c’était drôle de les faire
marcher, ces braves gens… M. Pougues, grand négociant !… Non,
la bonne blague !… Vous vous rappelez, il y a vingt-cinq ans, quand
on s’est connu aux Ternes ?… Eh bien ! il me semble que c’était
d’hier. Ma petite maman Pougues, je vous revois, accroupie par
terre, à laver votre boutique… Pendant ce temps-là, Pougues faisait
les livraisons dans sa petite poussette… Quand il y avait trop à faire,
je vous donnais un coup de main… Ah ! sapristi, c’est loin !…
Il se reversa un verre de cognac.
— Mon Dieu, c’est le père Buvard, souffla à son mari Mme
Pougues affolée. M. Pougues tressaillit douloureusement et blêmit.
— Lui-même, dit l’invité, avec un sourire agréable, Octave Buvat,
dit Buvard… Comment, mon vieux Pougues, vous ne m’aviez
vraiment pas reconnu ? Vous ne vous rappeliez pas mon vrai
nom ?… Allons, maintenant, vous me revoyez bien, hein ! dans ma
petite échoppe d’écrivain public ?… J’ai été un des derniers, mais
c’était déjà un métier qui se perdait, alors je vendais des chansons,
je louais des feuilletons en livraisons et, quand je n’avais pas de
clients, je lisais mon fonds… Et puis, j’ai changé de quartier, je suis
entré chez un bouquiniste ; mais ça n’a pas été brillant jusqu’à mon
héritage. La veine m’est venue tard, mais ça vaut mieux que jamais.
Vous, ce n’est pas la veine. C’est à force de trimer que vous êtes
sorti de la mistoufle. Hein ! on s’en donnait du mal pour manger à sa
faim ? Entendons-nous bien : Je ne veux pas dire que j’en ai honte,
d’avoir été pauvre… Je m’en vanterai plutôt… Quand je suis de
bonne humeur, j’ai envie de le crier sur les toits… Allons, à la santé
de la petite papeterie des Ternes !
Il s’était levé, son verre à la main. Sa voix formidable ébranlait la
maison et devait aller troubler le repos de la propriétaire. Avec une
expansion de tendresse il prit congé de ses hôtes, annonça qu’il
allait faire un tour au café de la Place, dit : « A demain ! » et sortit.
Entre M. et Mme Pougues, il y eut un silence atterré.
— C’est malheureux, dit enfin Mme Pougues, les larmes aux
yeux, on était si bien ici…
Et, par le premier train du lendemain, ils s’enfuirent.
LE MENSONGE

Mme Demblot venait de son œuvre pour les réfugiés et allait à


son œuvre pour les enfants. Il faisait beau temps ; elle marchait sans
lenteur ni hâte ; vêtue de sombre, un chapeau noir sur ses cheveux
grisonnants, la taille roide, le visage impassible, les yeux sévères,
elle paraissait, comme de coutume, aussi revêche, aussi autoritaire
que possible.
Soudain, comme Mme Demblot traversait le boulevard, elle
sursauta et réprima à peine une exclamation de stupeur.
Devant elle, son mari, M. Hector Demblot, passait, donnant le
bras à un soldat inconnu, jeune, de bonne mine, et dont l’autre bras
était en écharpe.
Mme Demblot, après son premier mouvement de surprise, ne
manifesta par nul signe qu’elle eût reconnu son mari. Elle passa
auprès de lui comme auprès d’un étranger, mais en le regardant
fixement. M. Demblot leva les yeux, la vit, tressaillit ; son visage, qui
était riant, devint gris de cendre.
Déjà Mme Demblot s’était éloignée d’un pas rapide. Une fièvre de
stupeur et de fureur l’animait. Elle essayait en vain de comprendre.
Trois jours avant, M. Demblot, comme il faisait de temps à autre,
était parti avec sa valise, disant qu’il était chargé d’une mission en
province. Pourquoi avait-il menti ? Pourquoi était-il à Paris ? Qui était
ce soldat ?
Il y avait vingt-deux ans qu’elle avait épousé M. Demblot et qu’il
était son esclave. Il n’avait jamais bien compris, lui-même, d’abord
comment il avait osé aimer et demander en mariage la redoutable
jeune fille qui devait devenir sa femme, ensuite pour quelles raisons
elle l’avait agréé. Il n’était pas beau, aucune gloire ne lui était
promise et enfin elle était assez riche, alors que lui ne l’était pas du
tout. Il avait fini par se convaincre que Mme Demblot l’avait épousé
par amour, — non pour lui, mais pour la tyrannie. Il avait vécu et
vieilli avec les impressions d’un petit garçon qui, sous la contrainte
de parents sévères, tremble dans la perpétuelle crainte des
châtiments. Pour M. Demblot, les châtiments c’étaient les scènes,
des scènes d’une sorte presque muette, de l’invention de Mme
Demblot, et que le pauvre homme redoutait tellement, qu’il restait
béant et terrifié, frémissant d’appréhension, lorsqu’il croyait avoir mal
fait. Tout tombait sur lui, le ménage étant sans enfants.
Mme Demblot n’alla pas à son œuvre et rentra chez elle. Elle
connaissait trop son mari pour ne pas être sûre que, l’ayant vue, il
allait, lui aussi, rentrer. Elle s’établit, raide, dans un fauteuil droit, au
milieu du salon hostile.
Un quart d’heure après, M. Demblot arriva. C’était un petit
homme de cinquante-cinq ans, aux joues roses et ridées, aux yeux
clairs, à la chevelure grise toujours un peu hérissée, et qui semblait
à la fois plus jeune et plus vieux que son âge. Sous le regard fixe
qu’attachait sur lui sa femme assise, rigide comme un juge, il crut
défaillir, avança en se tortillant, voulut parler, avala sa salive avec un
gloussement rauque et ne dit rien. Ces signes prouvèrent à Mme
Demblot qu’il était plus en faute encore qu’elle ne l’avait pensé.
— J’attends vos explications, dit-elle après un cruel silence.
— Tu… tu m’as vu… chère amie, commença-t-il. Je n’étais pas
seul… Je suis revenu subitement. Ma valise est à la gare… J’ai
rencontré un ami…
— Quel ami ? — Mme Demblot n’en avait laissé aucun à son mari.
— Je veux dire… ce soldat… c’est le fils d’un ami.
— Le fils de qui ?
— De… de… Lumoy… Tu sais bien. Lumoy… mon ancien
collègue de l’administration… Je t’en ai parlé… Alors, ce soldat…
c’est le fils de Lumoy…
Il pâlissait et rougissait ; il aurait pu faire pitié à quelqu’un d’autre
qu’à Mme Demblot, mais elle ne détournait pas son regard fixe. Il se
troubla davantage, s’affola, crut qu’elle savait peut-être et, en tous
cas, préférant tout à cet interrogatoire, dit brusquement la vérité :
— C’est mon fils, à moi…
Mme Demblot bondit dans son fauteuil.
— Vous… vous dites ? balbutia-t-elle avec stupeur.
— Oui, dit M. Demblot, mon fils à moi. Je n’aurais pas voulu que
tu saches jamais… Mais puisque tu nous a rencontrés… Tant pis…
Fais ce que tu voudras… C’est mon fils. Je l’ai eu avant notre
mariage. Il a vingt-six ans. Sa mère était une ouvrière, elle est morte
quand il est né… Trois ans après, je t’ai rencontrée. Quand nous
avons été fiancés, j’ai voulu te prévenir, mais je n’ai pas osé,
craignant une rupture, j’ai été lâche. Après notre mariage, de jour en
jour, j’ai remis… Tu es si vertueuse, n’est-ce pas, si rigide, si
inaccessible aux faiblesses. J’étais déjà si inférieur à toi… Si tu
savais quelles angoisses j’ai eues !… Enfin, je l’ai fait élever en
province. Je le voyais très rarement. J’ai eu l’argent en faisant des
travaux supplémentaires… Je ne t’ai causé aucun tort. Il est établi
en province. C’est un garçon instruit… J’ai inventé une histoire pour
expliquer les choses. Il sait que je suis marié avec toi, mais que,
pour des raisons de famille… Si tu savais comme c’est un garçon
intelligent, et brave, et énergique !… Tout le contraire de moi…
Mme Demblot était en proie à des sentiments violents, que
dominait l’intolérable outrage de ce mensonge prolongé, et où il y
avait peut-être un peu de respect étonné pour M. Demblot, qui en
avait été capable. Elle allait parler. Il l’interrompit :
— Non, je t’en prie… Je sais combien j’ai été coupable… Mais
maintenant… Enfin, il a été blessé, il est venu ici pour quelques
jours… Et je ne pouvais pas le laisser seul, quoi qu’il arrivât…
J’espérais que tu ne saurais pas, du reste… J’ai loué un petit
appartement meublé, pour lui et moi. Il sait qu’il ne peut pas venir
chez moi… Il accepte tout ce que je lui dis… Il est si respectueux, si
affectueux… Mais, tu comprends, il faut que je reste avec lui jusqu’à
ce qu’il reparte. Il va repartir bientôt… C’est mon fils. Et je ne le
reverrai peut-être jamais, acheva tout bas M. Demblot.
— Votre conduite est indigne ! — Mme Demblot s’était levée pour
plus de majesté, — indigne à tous les points de vue ! Quel rôle me
faites-vous jouer ! De quoi ai-je l’air aux yeux de ce jeune homme,
aux yeux du monde, qui apprendra peut-être ?… Je ne suis pas une
mégère, Monsieur, je le prouverai… J’entends que, pendant les jours
qui lui restent à passer ici, votre… (elle se reprit, tout au monde se
rapportait à elle), mon beau-fils habite avec nous… Il verra que je ne
suis pas le monstre odieux que vous lui avez dépeint…
— Tu veux bien… tu veux bien ?… Comme tu es bonne !… Je
cours le chercher, il m’attend dans un café.
M. Demblot sortit, mais remit aussitôt la tête à la porte.
« Devant lui, n’est-ce pas, ne me dis rien… » pria-t-il.
Elle fit un geste, il s’enfuit.
Mme Demblot resta seule, frémissante d’indignation, bouleversée
par des émotions qu’elle essayait en vain de définir.
Après un quart d’heure, M. Demblot revint. Le soldat
l’accompagnait. C’était un beau garçon au visage franc et intelligent.
Il s’inclina devant Mme Demblot.
— Madame, dit-il avec émotion, je suis très heureux d’être chez
vous… Mon père m’a dit votre bonté…
Et comme elle avait un petit mouvement :
« Oui, oui, je sais combien vous le rendez heureux… »
Mme Demblot regarda le pauvre homme qui lui faisait de timides
signes d’intelligence et se tortillait, gêné et souriant, derrière le dos
du soldat, et elle ne trouva rien à répondre.
LE CAHIER VERT

M. Bermide, à 7 h. 1/2 précises, rentra chez lui avec les deux


amis qu’il avait invités. Sa coutume était d’être en retard, et le dîner
ne se trouvait pas tout à fait prêt. M. Bermide, impétueux et
despotique, fut courroucé et le dit fortement. C’était inimaginable ! Y
pensait-on vraiment ? On savait bien cependant que lui, si large
d’esprit en toutes choses, était, à l’égard de l’exactitude qu’il
exigeait, inflexible !… Redressant sa taille qu’un embonpoint
naissant rendait plus majestueuse, rejetant de la main, en arrière de
son front, sa chevelure trop noire et qui se clairsemait, il allait et
venait dans le salon. Les deux invités, M. Valochon, professeur sans
élèves, et M. de Bivar, acteur sans théâtre, ne soufflaient mot,
sachant bien qu’on dînerait. Mme Bermide, pleine de contrition,
essayait faiblement d’apaiser son mari.
— Voyons, mon cher Adolphe… On va servir, je t’assure…
Voyons, mon cher Adolphe… répétait-elle d’une voix aussi douce
que son visage aux traits effacés, que le regard de ses yeux gris,
que la nuance de ses cheveux blonds cendrés.
Et comme la servante annonçait le dîner, M. Bermide consentit à
s’apaiser.
A table ces messieurs mangèrent bien et parlèrent beaucoup.
D’abord, M. Valochon et M. de Bivar, l’un jaune, chauve et fielleux,
l’autre blême, glabre et véhément, tous deux râpés et tous deux
incompris, se donnèrent la réplique, célébrant chacun son génie.
Mais M. Bermide ne les avait pas invités pour cela. Il éleva la voix et
parla de lui-même avec autorité, en phrases mesurées et hautaines
qui devinrent bientôt enthousiastes, et, comme il les nourrissait, tous
deux l’écoutèrent. Mme Bermide, discrètement, surveillait le service,
découpait et versait à boire, tout en restant comme suspendue aux
lèvres de son mari, qui d’ailleurs de temps à autre requérait son
témoignage : « Du reste, Marceline le sait… » Et elle répondait
fidèlement : « Oui, mon cher Adolphe. »
Vers onze heures les deux invités se retirèrent. Mme Bermide
passa dans sa chambre et M. Bermide resta au salon pour achever
son cigare.
Il fumait avec béatitude quand ses yeux se portèrent sur un petit
secrétaire placé en face de lui et dont se servait Mme Bermide, qui
n’avait permission d’entrer dans le bureau de son mari que pour le
ranger.
Sur le meuble, M. Bermide fut surpris de voir un cahier. Il se leva
et alla l’examiner. C’était un cahier de classe assez gros, vert et
avec un dos noir. Il l’ouvrit et reconnut l’écriture de sa femme.
Intrigué, il revint à sa place sous la lampe, lut quelques lignes, ne
comprit pas nettement, et se reporta au commencement du cahier,
dont un tiers à peine était écrit.
Sur la première page se trouvait cette mention : 14e cahier de
mon Journal.
— Ah ! par exemple !… Ah ! par exemple !… Elle tient un
journal !… C’est inimaginable !… murmura M. Bermide.
Il se demanda où pouvaient bien être dissimulés les autres
cahiers, mais le plus pressé était de prendre connaissance de celui
qu’il tenait. Il tourna la page et lut :
12 avril. — C’est l’anniversaire de notre mariage. Il ne m’en a rien
dit et je ne lui en ai rien dit parce que maintenant ça m’est égal. Il
m’a fait une scène à déjeuner à cause de l’omelette qu’il aurait voulu
au fromage… L’année dernière il était en voyage et l’année d’avant
je lui avais apporté des fleurs et il m’a dit que c’était ridicule, je l’ai vu
dans mon cahier de cette année-là, et que ce n’était plus de notre
âge. C’est vrai que cela fait quatorze ans que nous sommes
mariés… J’ai trente-six ans. Il en a quarante-sept. Il se teint les
cheveux et il croit que personne ne s’en aperçoit, sauf moi. Moi, je
ne compte pas. Je l’ai tant aimé, je l’ai tant admiré, et il en a tant
abusé ! Il a toujours été si sûr que jamais je ne me révolterai, que je
lui serai fidèle toute ma vie… Maintenant je ne pleure plus quand il
me fait des scènes… J’y suis habituée…
La première note s’arrêtait là. M. Bermide, trop ahuri pour se
rendre nettement compte de ce qui lui arrivait, tourna la page. Les
pages suivantes ne contenaient que de brèves indications, courses
faites ou scènes subies pour motifs variés. La constatation : « Je
m’ennuie » revenait assez souvent sans autres commentaires. Mme
Bermide ne tenait son Journal que très irrégulièrement et souvent
laissait passer plusieurs jours sans rien noter.
M. Bermide qui éprouvait une stupeur indicible, constata que
jamais sa femme ne le nommait. Elle l’appelait il ou bien lui.
Et il lisait :
7 mai. — Partie de campagne à Garches, chez sa sœur. Elle me
déteste et m’a lancé des insolences toute la journée. Les garçons
sont insupportables et ont, exprès, déchiré ma robe. Au retour, il m’a
reproché de ne pas aimer sa famille.
2 juin. — A déjeuner, il m’a parlé avec solennité d’économie
politique. Il veut maintenant s’y consacrer. Cela durera quelques
semaines, quelques mois au plus. Comme toujours, j’ai eu l’air de
m’intéresser à ce qu’il me disait. Ce n’est pas de l’hypocrisie de ma
part. C’est une habitude qui a été sincère très longtemps et que je
ne peux plus perdre. Il n’y a que quatre ou cinq ans que j’ai vraiment
cessé tout à fait de le croire un homme supérieur. Je sais,
maintenant. Il ne fera rien. Jamais. Il a essayé de tout depuis des
années, et c’est au point que je ne me rappelle même plus ce qu’il
faisait quand nous nous sommes mariés… Mon Dieu, l’admiration
que j’avais pour lui, à ce moment-là !… Il m’avait dit que je
participerais à son œuvre et j’en étais si fière ! Son œuvre !… Jamais
il ne fera rien, et si nous n’avions pas nos petites rentes… Mais
heureusement il est avare et, s’il gâche sa vie et la mienne, il sait
garder notre argent.
Le Journal continuait semblable, monotone et mélancolique. La
dernière note était du jour même.
26 septembre. — Il a invité à dîner Valochon, qui est sale, et de
Bivar (qui s’appelle Pufin), qui hurle et me broie les doigts. Il ne peut
plus supporter que les ratés ; il jalouse trop les autres. Il les
amènera, à moitié gris, du café. S’il est en avance, il me fera une
scène parce que le dîner ne sera pas prêt. S’il est en retard, il me
fera une scène parce que le rôti sera trop cuit. Dans les deux cas ce
sera « inimaginable » ! Et il parlera de lui sans interruption, avec
enthousiasme et en me prenant à témoin : « Marceline le sait ! » —
« Oui, mon cher Adolphe… »
— Mon Dieu ! cria une voix pleine d’angoisse.
Mme Bermide, en peignoir et les cheveux défaits, entrait. Dans
son lit elle s’était soudain souvenue avec affolement qu’elle avait
oublié, appelée par la servante, d’enfermer son Journal dans le tiroir
secret du secrétaire qu’elle seule connaissait.
Immobile, elle regardait le cahier vert aux mains de son mari. Elle
était saisie de terreur et de remords ; elle souffrait de la détresse
cruelle qu’il devait éprouver à être ainsi éclairé sur lui-même ; elle
espérait aussi, confusément, que maintenant peut-être il changerait.
M. Bermide, au cri jeté par sa femme, avait levé la tête. Une
indignation douloureuse et noble était sur son visage. Il dit
seulement :
— Alors… par toi aussi je suis méconnu ?
LE RIVAL

De bonne heure, M. Arthur Langlacy quitta son hôtel pour aller se


promener dans le parc de la station thermale. La douceur vaporeuse
et ensoleillée du matin calma son agacement. Il avait été chassé de
chez lui par les échos, mal atténués par les cloisons minces, d’une
scène qui venait d’éclater chez ses voisins. De ceux-ci, M. Langlacy
savait seulement le nom : de Ferlan, et que c’était un vieux ménage
qui devait être riche puisque l’hôtel était cher. Il avait à peine entrevu
un homme d’allure timide, à barbe grise, aux yeux résignés derrière
un lorgnon d’or, — une dame bien mise, de considérable prestance.
C’était elle qui faisait les scènes et elle les renouvelait souvent : des
scènes longues, âpres, implacables, faites par une personne bien
élevée qui contient sa voix et mesure ses injures. Parfois, protestait
faiblement une voix masculine aussitôt submergée par un
redoublement de reproches acerbes.
M. Langlacy faisait sans hâte le tour du parc. Il se trouvait en
bonne santé, ce matin-là, et il marchait d’un pas ferme, très jeune
d’aspect avec sa taille svelte dans son vêtement correct et son
visage à peine marqué, resté fin sous les cheveux blancs.
Il reprenait le chemin de la ville lorsque, débouchant d’une allée
latérale, il vit venir au-devant de lui Mme de Ferlan. Imposante et
élégante, les cheveux acajou, le visage fardé avec discrétion, de loin
elle était encore belle. Comme, en la croisant, M. Langlacy
ébauchait un geste de salut, elle laissa volontairement tomber son
ombrelle. Il la lui rendit, elle le remercia et se livra à quelques
considérations sur la ville et sur le temps. Elle les coupait de
silences qui paraissaient attendre. M. Langlacy n’y prenait point
garde, mais, comme Mme de Ferlan éveillait en lui un souvenir
confus, il se demandait s’il l’avait déjà rencontrée en réalité ou si,
seulement, elle lui en donnait l’impression, à cause de la banalité
apprêtée de son aspect qui l’apparentait à tant d’autres fortes dames
bien mises. Soudain, elle fit un pas vers M. Langlacy et, d’une voix
basse et pathétique, prononça ces mots :
— Oh ! Arthur, Arthur, votre cœur est donc toujours le même pour
moi !…
M. Langlacy, malgré la maîtrise qu’il avait de lui-même, eut un
sursaut de stupeur et recula. Comme dans un éclair, il l’avait
reconnue. Il avait retrouvé la voix et les traits de jadis sous la voix et
les traits d’à présent qui en étaient comme la caricature. Henriette !
C’était Henriette ! Un frisson soudain d’émotion et de souffrance le
reporta trente ans en arrière. Il l’avait aimée de telle sorte qu’aucun
autre amour n’avait jamais, pour lui, remplacé celui-là. Il avait failli
l’épouser. Il avait tenté de se tuer, lorsque, sans raisons, sinon qu’un
autre était venu, beaucoup plus riche et muni de hautes relations,
elle lui avait repris sa parole, devenant soudain impitoyable, dure,
presque cynique, en parlant d’argent et de position. Et, ensuite,
pendant combien d’années n’avait-il pas été torturé par son
souvenir, ne l’avait-il pas adorée malgré tout ?…
Pâle, dominant un frémissement, M. Langlacy écoutait sans bien
comprendre les mots, et, surtout, regardait Mme de Ferlan qui lui
parlait de la même voix sourde, vibrante, où elle mettait une émotion
qui se contient.
— Arthur, pourquoi m’avoir suivie et depuis si longtemps ?
L’année dernière déjà, au bord de la mer, votre présence, je l’ai
devinée… Oh ! ne niez pas, j’en suis sûre… Et, maintenant, vous
venez à moi ouvertement… Quand j’ai appris à l’hôtel le nom du
voyageur qui devenait notre voisin, j’ai compris…
Elle eut pour lui un regard profond.
M. Langlacy s’était ressaisi, était revenu au temps présent. Très
calme, il essaya de dire la simple vérité :
— Mais non, Madame, je vous assure… c’est le hasard…
j’ignorais…
Elle rit, incrédule et, comme jadis, sûre d’elle.
— Arthur, ne vous défendez pas… J’ai compris… Vous saviez qui
était Mme de Ferlan… Et elle ajouta : Ferlan est le nom d’une terre
qu’il (le mot, entre ses lèvres, siffla avec mépris et dérision) possède
dans le Poitou et que je l’ai contraint de prendre. Pouvais-je
m’appeler Beaupuy, comme il s’appelait quand je l’ai épousé ?…
Elle prit un temps, et, plus bas :
« Oh ! Arthur, quelle démence… Comment vous ai-je sacrifié,
vous… vous ! à cet homme ?… Mais n’étais-je pas une enfant mal
conseillée, une petite fille trop gâtée, qui laisse le bonheur pour le
plaisir ?… »
Elle s’arrêta encore et, soudain, la voix changée, dure, amère,
elle se mit à parler de son mari. Il était sans énergie, sans courage,
sans esprit et sans capacité. Il avait menti à toutes les ambitions
dont il lui avait promis la réalisation. Il avait échoué dans tout ce qu’il
avait entrepris. Il avait failli se ruiner en voulant augmenter sa
fortune. Il l’avait blessée dans ses aspirations, son orgueil et sa
délicatesse…
Mme de Ferlan ne s’observait plus. M. Langlacy reconnaissait les
phrases des scènes dont, sans le vouloir, il avait entendu des
lambeaux à travers les cloisons. Il la regardait et voyait se peindre
sur son visage fardé toute la somme d’injuste rancune dont elle était
capable, toute l’oppressive et mesquine méchanceté qui pouvait
l’animer.
Soudain, elle lui mit la main sur le bras.
« Le voici !… Regardez-le ! Non, mais regardez-le ! »
Promenant le petit chien de Mme de Ferlan dans une allée
voisine, dont les séparaient des buissons peu épais, le mari
s’avançait.
Jadis, M. Langlacy avait failli provoquer, en un duel à mort, M.
Beaupuy. Il avait eu pour lui une haine folle, et la seule idée de cet
homme le torturait de rage et de jalousie. Maintenant, à voir ce
vieillard à l’air humble et peureux, un peu courbé, comme sous un
fardeau trop lourd pour sa faiblesse, et qui, avec un visible respect,
trottait ou s’arrêtait selon le bon plaisir du chien, il se demandait
seulement ce que lui-même, Arthur Langlacy, serait, à la minute
présente, si, trente ans avant, il avait, triomphant de son rival, réussi
à épouser Henriette. Il se posa la question et frissonna un peu en
songeant à l’immense amour qu’il avait eu pour elle et à tout ce
qu’elle aurait pu faire de lui au gré de son caprice.
Mais Mme de Ferlan disait à son oreille :
« Et c’est à cet homme que je vous ai sacrifié, Arthur. Comme je
comprends maintenant que vous l’ayez haï…
— C’est vrai, je le haïssais… murmura M. Langlacy.
Il suivit d’un regard presque reconnaissant le mari qui s’éloignait
et ajouta d’un ton pénétré :
« Comme on peut être injuste, n’est-ce pas ?…
UN OUBLI

Après le déjeuner, M. Vadège constata qu’il avait quarante


minutes avant de retourner à son bureau, et il se versa avec
attention sa camomille.
Mme Vadège était assise de l’autre côté de la table et elle était si
jolie, si fraîche et si gracieuse qu’autour d’elle le décor de la petite
salle à manger paraissait plus banal et plus mesquin encore.
M. Vadège leva les yeux sur elle et sourit du seul plaisir de la
voir. Comme chaque jour, il lui demanda ce qu’elle ferait l’après-midi,
et elle le lui dit en détail. Il l’écoutait ravi. Depuis six ans qu’elle était
sa femme, il n’avait pas encore pu s’habituer à son bonheur, et il
n’avait pas encore pu comprendre comment Marcelle avait bien
voulu l’épouser, lui qui n’était ni beau, ni jeune, ni riche et qui n’avait
aucune chance d’être jamais autre chose qu’un fonctionnaire
modeste. Comme elle était dévouée, intelligente, adroite et active !
Malgré leurs modestes ressources, elle était toujours élégante, avec
des parures qui semblaient chères et ne l’étaient pas, des robes
neuves qui étaient de vieilles robes si bien transformées qu’il ne les
reconnaissait jamais. Il avait retrouvé auprès d’elle une
sentimentalité d’adolescent. Pendant les heures de son travail, la
pensée de Marcelle ne le quittait pas. Il l’imaginait dans leur
intérieur, ou bien en courses par les rues, traversant Paris pour
acheter à meilleur marché dans tel magasin qu’elle connaissait…
Elle était si économe et si sérieuse !…
Soudain, M. Vadège tressaillit si violemment que son lorgnon
tomba.
— Marcelle, c’est aujourd’hui samedi ! s’écria-t-il d’une voix
étranglée.
— Oui. Eh bien ? dit-elle étonnée.
— Le dîner de la cousine Armande… hier, vendredi !
— Nous l’avons oublié ! cria Marcelle en se dressant
bouleversée.
C’était une catastrophe. La cousine Armande, dont ils étaient les
seuls parents, était une vieille personne très riche, très fantasque et
très susceptible. Elle avait coutume, selon qu’elle était bien ou mal
avec les Vadège, de leur promettre son héritage, ou de leur jurer
qu’ils n’auraient jamais un sou d’elle. Les Vadège, malgré tout leur
zèle, n’avaient jamais su au juste ce qu’il fallait faire pour être bien
avec la cousine Armande : par contre, ils savaient à merveille que la
moindre négligence, le plus léger manque d’égards les fâchait avec
elle pour des mois et risquait de les frustrer de cette fortune qui était
le seul espoir de leur médiocrité.
Justement, après une brouille prolongée, ils venaient de l’apaiser
et elle les avait invités à dîner, faveur rare !… Et ce dîner, ils l’avaient
oublié ! Ils l’avaient oublié sans raison, stupidement. Ils n’y avaient
plus pensé, voilà ! C’était fou !
Ils s’imaginaient la cousine Armande chez elle, la veille au soir,
les attendant, s’irritant, plus furieuse à toutes les minutes, regrettant
ses préparatifs, car elle se piquait de bien recevoir et se plaisait à les
éblouir malgré qu’elle fût avare. Jamais elle ne leur pardonnerait un
tel affront…
Atterrés, ils se regardaient et, soudain, Marcelle éclata en
reproches violents. C’était de la faute de son mari ! Il ne pensait
jamais à rien ! Qu’avait-il dans l’esprit ? Elle se le demandait. Ce
n’était pas cependant sa besogne de scribe qui pouvait le
préoccuper… Par sa faute, ils perdaient leur seul espoir d’avenir !…
Elle s’animait, l’injuriait, se lançait dans une scène comme elle lui
en avait déjà fait quelques-unes, bien qu’elle fût en général
d’humeur égale. Lui, la tête basse, très malheureux, ne répondait
pas. Elle avait raison ; il avait tous les torts ; il eût seulement voulu
qu’elle criât moins fort.
Brusquement, elle s’arrêta. Elle regardait dans la rue à travers la
fenêtre.
— La voilà ! s’exclama-t-elle. La cousine Armande ! Elle vient ici !
Je l’ai vue traverser !
— Mon Dieu ! qu’est-ce qu’on va lui dire ? gémit Vadège.
— Laisse-moi faire, ordonna Marcelle éclairée par une idée
subite. Viens par ici !
Elle le poussa dans la chambre à coucher.
« Ote ta jaquette ! Ote ton faux col ! Dépêche-toi donc ! Mets ce
foulard, couche-toi sur le canapé… »
Elle étendit sur lui un couvre-pied, plaça un oreiller sous sa tête,
posa sur une table, au chevet du canapé, deux vieilles fioles de
potion et la tasse de camomille. Puis, en un instant, elle eut ôté sa
robe, passé un peignoir, défait ses cheveux.
« Tu comprends, tu as été très malade hier, souffla-t-elle à son
mari. Heureusement, tu as mauvaise mine ces jours-ci… »
On sonnait, elle alla ouvrir.
« Chut !… Ma cousine, je vous en supplie, ne faites pas de
bruit… Il a été bien mal, mais il repose… dit-elle à la cousine
Armande, qui arrivait avide de vengeance et qui, ahurie, demanda
des explications. »
Elle les eut longues et pathétiques. Vadège, la veille, avait failli
mourir. Le médecin était venu. Marcelle pleura. Quelle peur elle avait
eue !… Après quelques minutes, les deux femmes, à pas furtifs,
entrèrent dans la chambre à coucher. La cousine Armande
s’approcha du canapé ; son visage, habituellement revêche,
exprimait la compassion.
— Eh bien ! mon cousin, voyons, ça ne va donc pas ?
Vadège eut un vague grognement. Il avait si peur de la maladie
que le rôle qu’il jouait l’inquiétait malgré tout.
— Ça va un peu mieux, intervint Marcelle, mais il doit prendre
des précautions… Il se tue de travail…
— Il faut qu’il se soigne, dit la vieille dame émue. Voyons, vous
savez que je vous aime bien, tous les deux. Il faudra venir chez moi,

You might also like