(Ebook) C++ Programming: From Problem Analysis to Program Design, 5th by D. S. Malik ISBN 9780538798082, 0538798084 2024 Scribd Download
(Ebook) C++ Programming: From Problem Analysis to Program Design, 5th by D. S. Malik ISBN 9780538798082, 0538798084 2024 Scribd Download
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-4334672
ebooknice.com
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-7031230
ebooknice.com
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-4700604
ebooknice.com
https://ebooknice.com/product/java-programming-from-problem-analysis-
to-program-design-4th-edition-2365278
ebooknice.com
(Ebook) Java(TM) Programming: From Problem Analysis to Program Design
by D. S. Malik ISBN 9781111530532, 111153053X
https://ebooknice.com/product/java-tm-programming-from-problem-
analysis-to-program-design-2271130
ebooknice.com
https://ebooknice.com/product/java-programming-from-problem-analysis-
to-program-design-4130342
ebooknice.com
https://ebooknice.com/product/c-programming-program-design-including-
data-structures-5th-edition-2476526
ebooknice.com
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-2444624
ebooknice.com
https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-4178294
ebooknice.com
C++ PROGRAMMING:
FROM PROBLEM ANALYSIS TO PROGRAM DESIGN
FIFTH EDITION
D.S. MALIK
Australia Brazil Japan Korea Mexico Singapore Spain United Kingdom United States
C++ Programming: From Problem Analysis
to Program Design, Fifth Edition For product information and technology assistance, contact us at
Cengage Learning Customer & Sales Support, 1-800-354-9706
D.S. Malik For permission to use material from this text or product, submit
all requests online at www.cengage.com/permissions
Executive Editor: Marie Lee
Further permissions questions can be emailed to
Acquisitions Editor: Amy Jollymore permissionrequest@cengage.com
Senior Product Manager: Alyssa Pratt
Editorial Assistant: Zina Kresin Library of Congress Control Number: 2009942948
Content Project Manager: Matthew ISBN-13: 978-0-538-79808-2
Hutchinson
ISBN-10: 0-538-79808-4
Art Director: Faith Brosnan
Print Buyer: Julio Esperas Course Technology
20 Channel Center Street
Cover Designer: Roycroft Design/
Boston, MA 02210
www.roycroftdesign.com
USA
Cover Photo: ª Guntmar Fritz/Masterfile
Some of the product names and company names used in this
Proofreader: Green Pen QA book have been used for identification purposes only and may
Indexer: Elizabeth Cunningham be trademarks or registered trademarks of their respective
Compositor: Integra manufacturers and sellers.
Any fictional data related to persons or companies or URLs used
throughout this book is intended for instructional purposes only.
ª 2011 Course Technology, Cengage Learning At the time this book was printed, any such data was fictional
ALL RIGHTS RESERVED. No part of this work and not belonging to any real persons or companies.
covered by the copyright herein may be Course Technology, a part of Cengage Learning, reserves the
reproduced, transmitted, stored or used in any right to revise this publication and make changes from time to
form or by any means graphic, electronic, or time in its content without notice.
mechanical, including but not limited to
photocopying, recording, scanning, digitizing, The programs in this book are for instructional purposes only.
taping, Web distribution, information They have been tested with care, but are not guaranteed
networks, or information storage and retrieval for any particular intent beyond educational purposes. The
systems, except as permitted under Section author and the publisher do not offer any warranties or
107 or 108 of the 1976 United States Copyright representations, nor do they accept any liabilities with respect
Act, without the prior written permission of to the programs.
the publisher. Cengage Learning is a leading provider of customized
learning solutions with office locations around the globe,
including Singapore, the United Kingdom, Australia, Mexico,
Brazil and Japan. Locate your local office at:
www.cengage.com/global
Cengage Learning products are represented in Canada
by Nelson Education, Ltd.
To learn more about Course Technology, visit
www.cengage.com/coursetechnology
Purchase any of our products at your local college store or at
our preferred online store www.CengageBrain.com
My Daughter
Shelly Malik
This page intentionally left blank
B RIEF C ONTENTS
3. Input/Output 117
INDEX 1331
TABLE OF C ONTENTS
Preface xxvii
Programming Methodologies 20
Structured Programming 20
Object-Oriented Programming 20
Quick Review 22
Exercises 23
viii | C++ Programming: From Problem Analysis to Program Design, Fifth Edition
Expressions 44
Mixed Expressions 45
string Type 49
Input 50
Allocating Memory with Constants and Variables 50
Putting Data into Variables 53
Assignment Statement 53
Saving and Using the Value of an Expression 56
Declaring and Initializing Variables 57
Input (Read) Statement 58
Variable Initialization 61
Quick Review 98
Exercises 100
INPUT/OUTPUT 117
3 I/O Streams and Standard I/O Devices 118
cin and the Extraction Operator >> 119
Exercises 166
Exercises 232
Exercises 301
Exercises 350
Exercises 416
Namespaces 452
Exercises 477
Exercises 548
Exercises 603
Exercises 642
Exercises 713
Exercises 780
Programming Exercises 787
Exercises 849
Templates 925
Function Templates 925
Class Templates 927
Exercises 937
Exercises 986
RECURSION 991
17 Recursive Definitions 992
Direct and Indirect Recursion 995
Infinite Recursion 995
Exercises 1015
Programming Exercises 1018
LINKED LISTS 1023
18 Linked Lists 1024
Linked Lists: Some Properties 1025
Deletion 1031
Building a Linked List 1032
Exercises 1104
Queues 1165
Queue Operations 1166
Implementation of Queues as Arrays 1168
Linked Implementation of Queues 1177
Queue Derived from the
class unorderedLinkedListType 1182
Exercises 1204
Iterators 1284
IOStream Iterators 1285
Container Adapters 1285
Algorithms 1289
STL Algorithm Classification 1289
STL Algorithms 1292
Functions fill and fill_n 1292
Functions find and find_if 1294
xxvi | C++ Programming: From Problem Analysis to Program Design, Fifth Edition
Chapter 2 1304
Chapter 3 1306
Chapter 4 1307
Chapter 5 1309
Chapter 6 1311
Chapter 7 1312
Chapter 8 1313
Chapter 9 1314
Chapter 10 1316
Chapter 11 1317
Chapter 12 1318
Chapter 13 1321
Chapter 14 1322
Chapter 15 1323
Chapter 16 1324
Chapter 17 1325
Chapter 18 1326
Chapter 19 1327
INDEX 1331
P REFACE
WELCOME TO THE FIFTH EDITION OF C++ Programming: From Problem Analysis to Program
Design. Designed for a first Computer Science (CS1) C++ course, this text provides a
breath of fresh air to you and your students. The CS1 course serves as the cornerstone of
the Computer Science curriculum. My primary goal is to motivate and excite all CS1
students, regardless of their level. Motivation breeds excitement for learning. Motivation
and excitement are critical factors that lead to the success of the programming student. This
text is a culmination and development of my classroom notes throughout more than fifty
semesters of teaching successful programming to Computer Science students.
Warning: This text can be expected to create a serious reduction in the demand for
programming help during your office hours. Other side effects include significantly
diminished student dependency on others while learning to program.
C++ Programming: From Problem Analysis to Program Design started as a collection of brief
examples, exercises, and lengthy programming examples to supplement the books that were
in use at our university. It soon turned into a collection large enough to develop into a text.
The approach taken in this book is, in fact, driven by the students’ demand for clarity and readability.
The material was written and rewritten until the students felt comfortable with it. Most of the
examples in this book resulted from student interaction in the classroom.
As with any profession, practice is essential. Cooking students practice their recipes.
Budding violinists practice their scales. New programmers must practice solving
problems and writing code. This is not a C++ cookbook. We do not simply list the
C++ syntax followed by an example; we dissect the ‘‘why’’ behind all the concepts. The
crucial question of ‘‘why?’’ is answered for every topic when first introduced. This
technique offers a bridge to learning C++. Students must understand the ‘‘why?’’ in
order to be motivated to learn.
Traditionally, a C++ programming neophyte needed a working knowledge of another
programming language. This book assumes no prior programming experience. However,
some adequate mathematics background, such as college algebra, is required.
xxviii | C++ Programming: From Problem Analysis to Program Design, Fifth Edition
Approach
The programming language C++, which evolved from C, is no longer considered an
industry-only language. Numerous colleges and universities use C++ for their first program-
ming language course. C++ is a combination of structured programming and object-oriented
programming, and this book addresses both types.
This book can be easily divided into two parts: structured programming and object-oriented
programming. The first 11 chapters form the structured programming part; Chapters 12
through 19 form the object-oriented part. However, only the first seven chapters are essential
to move on to the object-oriented portion.
In July 1998, ANSI/ISO Standard C++ was officially approved. This book focuses on ANSI/
ISO Standard C++. Even though the syntax of Standard C++ and ANSI/ISO Standard C++
is very similar, Chapter 8 discusses some of the features of ANSI/ISO Standard C++ that are
not available in Standard C++.
Chapter 1 briefly reviews the history of computers and programming languages. The reader can
quickly skim through this chapter and become familiar with some of the hardware components
and the software parts of the computer. This chapter contains a section on processing a C++
program. This chapter also describes structured and object-oriented programming.
Chapter 2 discusses the basic elements of C++. After completing this chapter, students
become familiar with the basics of C++ and are ready to write programs that are complicated
enough to do some computations. Input/output is fundamental to any programming
language. It is introduced early, in Chapter 3, and is covered in detail.
Chapters 4 and 5 introduce control structures to alter the sequential flow of execution.
Chapters 6 and 7 study user-defined functions. It is recommended that readers with no prior
programming background spend extra time on Chapters 6 and 7. Several examples are provided
to help readers understand the concepts of parameter passing and the scope of an identifier.
Preface | xxix
Chapter 8 discusses the user-defined simple data type (enumeration type), the namespace
mechanism of ANSI/ISO Standard C++, and the string type. The earlier versions of C did
not include the enumeration type. Enumeration types have very limited use; their main
purpose is to make the program readable. This book is organized such that readers can skip
the section on enumeration types during the first reading without experiencing any disconti-
nuity, and then later go through this section.
Chapter 9 discusses arrays in detail. Chapter 10 describes various searching and sorting
algorithms as well as an introduction to the vector class. Chapter 11 introduces records
(structs). The introduction of structs in this book is similar to C structs. This chapter is
optional; it is not a prerequisite for any of the remaining chapters.
Chapter 12 begins the study of object-oriented programming (OOP) and introduces classes.
The first half of this chapter shows how classes are defined and used in a program. The second
half of the chapter introduces abstract data types (ADTs). This chapter shows how classes in
C++ are a natural way to implement ADTs. Chapter 13 continues with the fundamentals of
object-oriented design (OOD) and OOP and discusses inheritance and composition. It
explains how classes in C++ provide a natural mechanism for OOD and how C++ supports
OOP. Chapter 13 also discusses how to find the objects in a given problem.
Chapter 14 studies pointers in detail. After introducing pointers and how to use them in a
program, this chapter highlights the peculiarities of classes with pointer data members and
how to avoid them. Moreover, this chapter also discusses how to create and work with
dynamic two-dimensional arrays. Chapter 14 also discusses abstract classes and a type of
polymorphism accomplished via virtual functions.
Chapter 15 continues the study of OOD and OOP. In particular, it studies polymorphism in C++.
The chapter specifically discusses two types of polymorphism—overloading and templates.
Chapter 16 discusses exception handling in detail. Chapter 17 introduces and discusses recur-
sion. Moreover, this is a standalone chapter, so it can be studied anytime after Chapter 10.
Chapters 18 and 19 are devoted to the study of data structures. Discussed in detail are linked
lists in Chapter 18 and stacks and queues in Chapter 19. The programming code developed in
these chapters is generic. These chapters effectively use the fundamentals of OOD.
Appendix A lists the reserved words in C++. Appendix B shows the precedence and
associativity of the C++ operators. Appendix C lists the ASCII (American Standard Code
for Information Interchange) and EBCDIC (Extended Binary Coded Decimal Interchange
Code) character sets. Appendix D lists the C++ operators that can be overloaded.
Appendix E has three objectives. First, we discuss how to convert a number from decimal to
binary and binary to decimal. We then discuss binary and random access files in detail.
Finally, we describe the naming conventions of the header files in both ANSI/ISO Standard
C++ and Standard C++. Appendix F discusses some of the most widely used library
routines, and includes the names of the standard C++ header files. The programs in
Appendix G show how to print the memory size for the built-in data types on your system
as well as how to use a random number generator. Appendix H gives an introduction to
xxx | C++ Programming: From Problem Analysis to Program Design, Fifth Edition
the Standard Template Library, and Appendix I provides the answers to odd-numbered
exercises in the book.
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8 Chapter 9*
Chapter 15
Chapter 17
Chapter 18
Chapter 19
In Figure 1, dotted lines mean the preceding chapter is used in one of the sections of the
chapter and is not necessarily a prerequisite for the next chapter. For example, Chapter 9
covers arrays in detail. In Chapters 11 and 12, we show the relationship between arrays and
structs and arrays and classes, respectively. However, if Chapter 12 is studied before
Chapter 9, then the section dealing with arrays in Chapter 12 can be skipped without any
discontinuation. This particular section can be studied after studying chapter 9.
It is recommended that the first seven chapters be covered sequentially. After covering the
first seven chapters, if the reader is interested in learning OOD and OOP early, then Chapter
12 can be studied right after Chapter 7. Chapter 8 can be studied any time after Chapter 7.
After studying the first seven chapters in sequence, some of the approaches are:
1. Study chapters in the sequence: 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19.
2. Study chapters in the sequence: 9, 12, 14, 15, 13, 17, 18, 19, 10, 16.
3. Study chapters in the sequence: 12, 9, 10, 14, 15, 13, 17, 18, 19, 16.
4. Study chapters in the sequence: 12, 9, 14, 15, 13, 17, 18, 19, 10, 16.
FEATURES OF THE BOOK
Four-color
interior design
shows
accurate C++
code and
related
comments.
More than 300
visual diagrams,
both extensive
and exhaustive,
illustrate difficult
concepts.
Numbered examples
illustrate the key
concepts with their
relevant code. The
programming code
in these examples is
followed by a
Sample Run. An
explanation then
follows that
describes what each
line in the code
does.
The following supplemental materials are available when this book is used in a classroom
setting.
All instructor teaching tools are available with this book on a single CD-ROM.
ExamViewÒ
This textbook is accompanied by ExamView, a powerful testing software package that allows
instructors to create and administer printed, computer (LAN-based), and Internet exams.
ExamView includes hundreds of questions that correspond to the topics covered in this
text, enabling students to generate detailed study guides that include page references for
further review. These computer-based and Internet testing components allow students to
take exams at their computers, and save the instructor time because each exam is graded
automatically.
PowerPoint Presentations
This book comes with Microsoft PowerPoint slides for each chapter. These are included as a
teaching aid for classroom presentations, either to make available to students on the network
for chapter review, or to be printed for classroom distribution. Instructors can add their own
slides for additional topics that they introduce to the class.
Supplemental Resources | xxxix
Source Code
The source code, in ANSI/ISO Standard C++, is available at www.course.com, and is also
available on the Instructor Resources CD-ROM. The input files needed to run some of the
programs are also included with the source code.
Solution Files
The solution files for all Programming Exercises, in ANSI/ISO C++, are available at www.course.
com, and are also available on the Instructor Resources CD-ROM. The input files needed to run
some of the Programming Exercises are also included with the solution files.
A CKNOWLEDGEMENTS
There are many people that I must thank who, one way or another, contributed to the success
of this book. First, I would like to thank all the students who, during the preparation, were
spontaneous in telling me if certain portions needed to be reworded for better understanding
and clearer reading. Next, I would like to thank those who e-mailed numerous comments to
improve upon the second edition. I am thankful to Professors S.C. Cheng, Randall Crist, and
Vasant Raval for constantly supporting this project. I am also very grateful to the reviewers
who reviewed earlier versions of this book and offered many critical suggestions on how to
improve it.
I owe a great deal to the following reviewers who patiently read each page of every chapter of
the current version and made critical comments to improve on the book: Stefano Basagni,
Northeastern University; Jeff Ringenberg, University of Michigan; Colleen van Lent, Uni-
versity of Michigan; Tuan Vo, Mt. San Antonio College; Kerstin Voigt, California State
University San Bernardino; Lan Yang, Cal Poly Pomona. The reviewers will recognize that
their criticisms have not been overlooked and, in fact, made this a better book.
Next, I express thanks to Amy Jollymore, acquisition editor, for recognizing the importance
and uniqueness of this project. All this would not have been possible without the careful
planning of Senior Product Manager Alyssa Pratt. I extend my sincere thanks to Alyssa, as well
as to Content Project Manager, Mathew Hutchinson. I also thank Tintu Thomas of Integra
Software Services for assisting us in keeping the project on schedule. I would like to thank
Chris Scriver and Serge Palladino of QA department of Course Technology for patiently and
carefully proof reading the text, testing the code, and discovering typos and errors.
I am thankful to my parents for their blessings.
Finally, I am thankful for the support of my wife Sadhana and especially my daughter Shelly,
to whom this book is dedicated. She cheered me up whenever I was overwhelmed during the
writing of this book, and also made sure that the corrections were in place. Shelly always
draws special joy whenever I undertake such projects.
I welcome any comments concerning the text. Comments may be forwarded to the following
e-mail address: malik@creighton.edu
D. S. Malik
1
CHAPTER
A N O VERVIEW OF
COMPUTERS AND
P ROGRAMMING
L ANGUAGES
I N T H I S C H A P T E R , YO U W I L L :
. Learn about different types of computers
. Explore the hardware and software components of a computer system
. Learn about the language of a computer
. Learn about the evolution of programming languages
. Examine high-level programming languages
. Discover what a compiler is and what it does
. Examine a C++ program
. Explore how a C++ program is processed
. Learn what an algorithm is and explore problem-solving techniques
. Become aware of structured design and object-oriented design programming methodologies
. Become aware of Standard C++ and ANSI/ISO Standard C++
2 | Chapter 1: An Overview of Computers and Programming Languages
Introduction
Terms such as ‘‘the Internet,’’ which were unfamiliar just 20 years ago are now common.
Students in elementary school regularly ‘‘surf ’’ the Internet and use computers to design their
classroom projects. Many people use the Internet to look for information and to commu-
nicate with others. This is all made possible by the availability of different software, also
known as computer programs. Without software, a computer is useless. Software is devel-
oped by using programming languages. The programming language C++ is especially well
suited for developing software to accomplish specific tasks. Our main objective is to help you
learn how to write programs in the C++ programming language. Before you begin
programming, it is useful to understand some of the basic terminology and different
components of a computer. We begin with an overview of the history of computers.
The first computer-like machine was the Mark I. It was built, in 1944, jointly by IBM and
Harvard University under the leadership of Howard Aiken. Punched cards were used to feed 1
data into the machine. The Mark I was 52 feet long, weighed 50 tons, and had 750,000 parts.
In 1946, the ENIAC (Electronic Numerical Integrator and Calculator) was built at the
University of Pennsylvania. It contained 18,000 vacuum tubes and weighed some 30 tons.
The computers that we know today use the design rules given by John von Neumann in
the late 1940s. His design included components such as an arithmetic logic unit, a control
unit, memory, and input/output devices. These components are described in the next
section. Von Neumann’s computer design makes it possible to store the programming
instructions and the data in the same memory space. In 1951, the UNIVAC (Universal
Automatic Computer) was built and sold to the U.S. Census Bureau.
In 1956, the invention of transistors resulted in smaller, faster, more reliable, and more
energy-efficient computers. This era also saw the emergence of the software development
industry, with the introduction of FORTRAN and COBOL, two early programming
languages. In the next major technological advancement, transistors were replaced by tiny
integrated circuits, or ‘‘chips.’’ Chips are smaller and cheaper than transistors and can contain
thousands of circuits on a single chip. They give computers tremendous processing speed.
In 1970, the microprocessor, an entire CPU on a single chip, was invented. In 1977,
Stephen Wozniak and Steven Jobs designed and built the first Apple computer in their
garage. In 1981, IBM introduced its personal computer (PC). In the 1980s, clones of the
IBM PC made the personal computer even more affordable. By the mid-1990s, people
from many walks of life were able to afford them. Computers continue to become faster
and less expensive as technology advances.
Modern-day computers are powerful, reliable, and easy to use. They can accept spoken-word
instructions and imitate human reasoning through artificial intelligence. Expert systems assist
doctors in making diagnoses. Mobile computing applications are growing significantly. Using
handheld devices, delivery drivers can access global positioning satellites (GPS) to verify
customer locations for pickups and deliveries. Cell phones permit you to check your e-mail,
make airline reservations, see how stocks are performing, and access your bank accounts.
Although there are several categories of computers, such as mainframe, midsize, and
micro, all computers share some basic elements, described in the next section.
Processor 2.80 GHz, 1GB RAM, 250 GB HD, VX750 19" Silver Flat CRT Color Monitor’’
fall into the hardware category; items such as ‘‘operating system, games, encyclopedias, and
application software’’ fall into the software category. Let’s consider the hardware first.
Hardware
Major hardware components include the central processing unit (CPU); main memory
(MM), also called random access memory (RAM); input/output devices; and secondary
storage. Some examples of input devices are the keyboard, mouse, and secondary storage.
Examples of output devices are the screen, printer, and secondary storage. Let’s look at
each of these components in greater detail.
. .
Input . .
Central . .
Device
Processing 1000 54
Unit (CPU) 1001
Output A
. .
Device . .
. .
Main Memory 2000
2001
. .
. .
. .
Secondary Storage Main Memory
(a) (b)
Main memory, or random access memory, is connected directly to the CPU. All
programs must be loaded into main memory before they can be executed. Similarly, all
data must be brought into main memory before a program can manipulate it. When the
computer is turned off, everything in main memory is lost.
Main memory is an ordered sequence of cells, called memory cells. Each cell has a unique
location in main memory, called the address of the cell. These addresses help you access
the information stored in the cell. Figure 1-1(b) shows main memory with some data.
Random documents with unrelated
content Scribd suggests to you:
Triste comme un lion mangé par la vermine!
—Charles-Quint! dans ces temps d’opprobre et de
terreur,
Que fais-tu dans ta tombe, ô puissant empereur?
Oh! lève-toi! viens voir!—Les bons font place aux
pires.
Ce royaume effrayant, fait d’un amas d’empires,
Penche... Il nous faut ton bras! au secours, Charles-
Quint!
Car l’Espagne se meurt! car l’Espagne s’éteint!
Ton globe, qui brillait dans ta droite profonde,
Soleil éblouissant, qui faisait croire au monde
Que le jour désormais se levait à Madrid,
Maintenant, astre mort, dans l’ombre s’amoindrit,
Lune aux trois quarts rongée et qui décroît encore,
Et que d’un autre peuple effacera l’aurore!
Hélas! ton héritage est en proie aux vendeurs.
Tes rayons, ils en font des piastres! Tes splendeurs,
On les souille!—O géant! se peut-il que tu dormes?—
On vend ton sceptre au poids! un tas de nains
difformes
Se taillent des pourpoints dans ton manteau de roi;
Et l’aigle impérial qui, jadis, sous ta loi,
Couvrait le monde entier de tonnerre, et de flamme,
Cuit, pauvre oiseau plumé, dans leur marmite infâme!
Les conseillers se taisent consternés. Seuls, le marquis de Priego et le
comte de Camporeal redressent la tête et regardent Ruy Blas avec
colère. Puis Camporeal, après avoir parlé à Priego, va à la table, écrit
quelques mots sur un papier, les signe et les fait signer au marquis.
Merci.
Vous vous retirerez, avec votre famille,
A Priego.
Vous, en Andalousie,—
A Camporeal.
COVADENGA.
UBILLA.
Il sera Richelieu!
DON MANUEL ARIAS.
RUY BLAS, après avoir parcouru vivement une lettre qu’il vient d’ouvrir.
Allons! qu’est-ce!
L’HUISSIER.
A Votre Excellence
J’annonce monseigneur l’ambassadeur de France.
RUY BLAS.
L’HUISSIER, s’inclinant.
Monseigneur,
Le nonce impérial dans la chambre d’honneur
Attend Votre Excellence.
RUY BLAS.
LE PAGE, bas.
Ruy Blas, resté seul, fait quelques pas en proie à une rêverie profonde.
Tout à coup, à l’angle du salon, la tapisserie s’écarte et la reine
apparaît. Elle est vêtue de blanc avec la couronne en tête; elle paraît
rayonnante de joie et fixe sur Ruy Blas un regard d’admiration et de
respect. Elle soutient d’un bras la tapisserie derrière laquelle on
entrevoit une sorte de cabinet obscur où l’on distingue une petite
porte. Ruy Blas, en se retournant, aperçoit la reine et reste comme
pétrifié devant cette apparition.
SCÈNE TROISIÈME.
RUY BLAS, LA REINE.
Oh! merci!
RUY BLAS.
Ciel!
LA REINE.
RUY BLAS.
A part.
LA REINE.
RUY BLAS.
Et que disait-il?
LA REINE.
Rien.
RUY BLAS.
LA REINE.
Il allait à la chasse.
Mais vous! j’entends encor votre accent qui menace.
Comme vous les traitiez d’une haute façon,
Et comme vous aviez superbement raison!
Je soulevais le bord de la tapisserie,
Je vous voyais. Votre œil, irrité sans furie,
Les foudroyait d’éclairs, et vous leur disiez tout.
Vous me sembliez seul être resté debout!
Mais où donc avez-vous appris toutes ces choses?
D’où vient que vous savez les effets et les causes?
Vous n’ignorez donc rien? D’où vient que votre voix
Parlait comme devrait parler celle des rois?
Pourquoi donc étiez-vous, comme eût été Dieu même,
Si terrible et si grand?
RUY BLAS.
LA REINE.
LA REINE.
Madame...
LA REINE, gravement.
Adieu.
Elle soulève la tapisserie et disparaît.
SCÈNE QUATRIÈME.
RUY BLAS, seul.
Bonjour.
A part.
Je parie
Que tous ne pensiez pas à moi.
RUY BLAS.
Sa seigneurie
En effet me surprend.
A part.
DON SALLUSTE.
RUY BLAS, l’œil fixé sur don Salluste impassible, pouvant à peine
rassembler ses idées.
Cette livrée?...
DON SALLUSTE, souriant toujours.
RUY BLAS.
DON SALLUSTE.
RUY BLAS.
DON SALLUSTE.
RUY BLAS.
DON SALLUSTE.
DON SALLUSTE.
—Vous disiez?...
RUY BLAS.
RUY BLAS.
Vous le saviez!
DON SALLUSTE.
Pardieu!
Qu’est-ce que cela fait?
DON SALLUSTE.
DON SALLUSTE.
Grâce!
DON SALLUSTE.
DON SALLUSTE.
Comment dit-il cela? Répétez-donc la phrase.
Ruy Blas, duc d’Olmedo? Vos yeux ont un bandeau.
Ce n’est que sur Bazan qu’on a mis Olmedo.
RUY BLAS.
DON SALLUSTE.
Mais...
DON SALLUSTE.
RUY BLAS.
Je nierai tout!
DON SALLUSTE.
RUY BLAS.
DON SALLUSTE.
On vient.
Il salue profondément Ruy Blas. Haut.
RUY BLAS.
DON CÉSAR.
DON SALLUSTE.
DON GURITAN.
UN LAQUAIS.
UNE DUÈGNE.
UN PAGE.
UN ALCADE.
DES ALGUAZILS.
DEUX MUETS.
ACTE QUATRIÈME.
Une petite chambre somptueuse et sombre. Lambris et meubles
de vieille forme et de vieille dorure. Murs couverts d’anciennes
tentures de velours cramoisi, écrasé et miroitant par places et
derrière le dos des fauteuils, avec de larges galons d’or qui le
divisent en bandes verticales. Au fond, une porte à deux
battants. A gauche, sur un pan coupé, une grande cheminée
sculptée du temps de Philippe II, avec écusson de fer battu
dans l’intérieur. Du côté opposé, sur un pan coupé, une petite
porte basse donnant dans un cabinet obscur. Une seule
fenêtre à gauche, placée très-haut et garnie de barreaux et
d’un auvent inférieur comme les croisées des prisons. Sur le
mur, quelques vieux portraits enfumés et à demi effacés.
Coffre de garde-robe avec miroir de Venise. Grands fauteuils
du temps de Philippe III. Une armoire très-ornée adossée au
mur. Une table carrée avec ce qu’il faut pour écrire. Un petit
guéridon de forme ronde à pieds dorés dans un coin. C’est le
matin.
SCÈNE PREMIÈRE.
RUY BLAS, LE PAGE.
Ah!
Il tire de son garde-notes une feuille et un crayon.
LE PAGE.
RUY BLAS.
LE PAGE.
Mes esprits
Se calment. Cependant, comme dans la folie,
Je sens confusément des choses que j’oublie.
Oui, le moyen est sûr. Don Guritan...!—mais moi?
Faut-il attendre ici don Salluste? Pourquoi?
Non. Ne l’attendons pas. Cela le paralyse
Tout un grand jour. Allons prier dans quelque église.
Sortons. J’ai besoin d’aide, et Dieu m’inspirera!
Il prend son chapeau sur une crédence, et secoue une sonnette posée
sur la table. Deux nègres, vêtus de velours vert-clair et de brocard
d’or, jaquettes plissées à grandes basques, paraissent à la porte du
fond.
Je sors. Dans un instant un homme ici viendra.
—Par une entrée à lui.—Dans la maison, peut-être,
Vous le verrez agir comme s’il était maître.
Laissez-le faire. Et si d’autres viennent...
Après avoir hésité un moment.
Ma foi,
Vous laisserez entrer!—
Il congédie du geste les noirs, qui s’inclinent en signe d’obéissance et
qui sortent.
Allons?
Il sort.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com