0% found this document useful (0 votes)
6 views

Programming With C 3rd Edition Ravichandran instant download

The document provides information about the book 'Programming with C++, 3rd Edition' by D. Ravichandran, including its publication details and content structure. It covers various programming concepts such as object-oriented programming, data types, control statements, functions, and inheritance. The book is published by Tata McGraw Hill Education and is aimed at enhancing programming skills in C++.

Uploaded by

samonsfeir0n
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Programming With C 3rd Edition Ravichandran instant download

The document provides information about the book 'Programming with C++, 3rd Edition' by D. Ravichandran, including its publication details and content structure. It covers various programming concepts such as object-oriented programming, data types, control statements, functions, and inheritance. The book is published by Tata McGraw Hill Education and is aimed at enhancing programming skills in C++.

Uploaded by

samonsfeir0n
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Programming With C 3rd Edition Ravichandran pdf

download

https://ebookname.com/product/programming-with-c-3rd-edition-
ravichandran/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming problem solving abstraction with C Moffat

https://ebookname.com/product/programming-problem-solving-
abstraction-with-c-moffat/

Windows Forms Programming with C 1st Edition Erik Brown

https://ebookname.com/product/windows-forms-programming-
with-c-1st-edition-erik-brown/

Object Oriented Programming With C 4th Edition E.


Balagurusamy

https://ebookname.com/product/object-oriented-programming-
with-c-4th-edition-e-balagurusamy/

Storytown Winning Catch Grade 4 Reader 1st Edition


Harcourt School Publishers

https://ebookname.com/product/storytown-winning-catch-
grade-4-reader-1st-edition-harcourt-school-publishers/
The State of Southern Illinois An Illustrated History
1st Edition Herbert K. Russell

https://ebookname.com/product/the-state-of-southern-illinois-an-
illustrated-history-1st-edition-herbert-k-russell/

Latin American Novels of the Conquest Reinventing the


New World 1st Edition Kimberle S. Lopez

https://ebookname.com/product/latin-american-novels-of-the-
conquest-reinventing-the-new-world-1st-edition-kimberle-s-lopez/

Surface and Interface Science Volume 3 and 4 Volume 3


Properties of Composite Surfaces Volume 4 Solid Solid
Interfaces and Thin Films 1st Edition Klaus Wandelt

https://ebookname.com/product/surface-and-interface-science-
volume-3-and-4-volume-3-properties-of-composite-surfaces-
volume-4-solid-solid-interfaces-and-thin-films-1st-edition-klaus-
wandelt/

Pro HTML5 and CSS3 Design Patterns 1st Edition Michael


Bowers

https://ebookname.com/product/pro-html5-and-css3-design-
patterns-1st-edition-michael-bowers/

Scanner Data and Price Indexes Robert C. Feenstra

https://ebookname.com/product/scanner-data-and-price-indexes-
robert-c-feenstra/
Introduction to 3G Mobile Communications 2nd ed Edition
Juha Korhonen

https://ebookname.com/product/introduction-to-3g-mobile-
communications-2nd-ed-edition-juha-korhonen/
Programming with

C++
Third Edition
About the Author

D Ravichandran is currently based in Hyderabad and is a corporate trainer in software engineering, data
structures and algorithms, and programming languages. He was earlier a senior faculty in the Department
of Computing, Middle East College of Information Technology, Muscat, Sultanate of Oman. He was also
a faculty member of Department of Computer Science and Engineering, Pondicherry Engineering College,
Pondicherry, for more than 15 years. He is an expert in several computer programming languages and has
more than two decades of professional programming experience. A prolific writer, he has already published
many books in the field of computer science and information technology. His affiliations include a life
membership of the Indian Society for Technical Education and a membership of the Computer Society of
India.
Programming with

C++
Third Edition

D Ravichandran
Corporate Trainer in Software Engineering
Data Structures and Algorithms and Programming Languages
Hyderabad

Tata McGraw Hill Education Private Limited


NEW DELHI
McGraw-Hill Offices
New Delhi New York St Louis San Francisco Auckland Bogotá Caracas
Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal
San Juan Santiago Singapore Sydney Tokyo Toronto
Published by the Tata McGraw Hill Education Private Limited,
7 West Patel Nagar, New Delhi 110 008.

Programming with C++, 3/e

Copyright © 2011, 2003, 1996, by Tata McGraw Hill Education Private Limited.
No part of this publication may be reproduced or distributed in any form or by any means,
electronic, mechanical, photocopying, recording, or otherwise or stored in a database or
retrieval system without the prior written permission of the publishers. The program listing
(if any) may be entered, stored and executed in a computer system, but they may not be
reproduced for publication.

This edition can be exported from India only by the publishers,


Tata McGraw Hill Education Private Limited.

ISBN-13 digits: 978-0-07-068189-7


ISBN-10 digits: 0-07-068189-9

Vice President and Managing Director—McGraw-Hill Education: Asia Pacific Region: Ajay Shukla

Head—Higher Education Publishing and Marketing: Vibha Mahajan


Manager: Sponsoring—SEM & Tech Ed: Shalini Jha
Asst Sponsoring Editor: Surabhi Shukla
Development Editor: Surbhi Suman
Executive—Editorial Services: Sohini Mukherjee
Jr Production Manager: Anjali Razdan
Dy Marketing Manager—SEM & Tech Ed: Biju Ganesan
General Manager—Production: Rajender P Ghansela
Asst General Manager—Production: B L Dogra

Information contained in this work has been obtained by Tata McGraw-Hill, from sources believed to be reliable.
However, neither Tata McGraw-Hill nor its authors guarantee the accuracy or completeness of any information
published herein, and neither Tata McGraw-Hill nor its authors shall be responsible for any errors, omissions,
or damages arising out of use of this information. This work is published with the understanding that Tata
McGraw-Hill and its authors are supplying information but are not attempting to render engineering or other
professional services. If such services are required, the assistance of an appropriate professional should be sought.

Typeset at Bukprint India, B-180A, Guru Nanak Pura, Laxmi Nagar-110 092 and printed at
Avon Printers, Plot No. 16, Main Loni Road, Jawahar Nagar, Industrial Area, Shahdara, Delhi 110 094

Cover Printer: SDR Printers

RQXCRRQZDLCZL
Dedicated to my son

Suseekaran
for his love and support
Contents

Preface to the Third Edition xv


Acknowledgements ix

1. Introduction to Object Oriented Programming 1


1.1 Introduction 1
1.2 What is Object Oriented Programming (OOP)? 2
1.3 Structured Procedural Programming (SPP) 2
1.4 Object Oriented Programming OPP 3
1.5 Characteristics of OOPs 3
1.6 Advantages of OOPs 6
1.7 Disadvantages of OOPs 7
1.8 Comparison of Structured Procedural Programming (SPP) and Object Oriented Programming
(OOP) 7
1.9 Steps in Developing OOP Programs 8
1.10 Structure of Object Oriented Programs 9
1.11 Object Oriented Languages 11
1.12 Importance of C++ 11
Review Questions 12

2. Building ANSI C++ Program 13


2.1 Introduction 13
2.2 History of C++ 13
2.3 The Latest Addenda to ANSI/ISO C++ 15
2.4 Possible Future Additions to C++ 16
2.5 C++ versus C 16
2.6 Versions of C++ 17
2.7 Source Program Names 17
2.8 Compiling and Debugging C++ Programs 17
2.9 Stages of Program Development 18
2.10 Compiling GNU GCC/G++ in Linux 20
2.11 Compiling C/C++ Program in UNIX 21
2.12 Building C++ Under Microsoft .NET Platform 22
Review Questions 31
viii Contents

3. Data Types, Operators and Expressions 32


3.1 Identifiers and Keywords 32
3.2 Data Types 34
3.3 C++ Simple Data Types 35
3.4 Literals 38
3.5 Variables 43
3.6 The Const Datatype 45
3.7 C++ Operators 46
3.8 Arithmetic Operators 46
3.9 Assignment Operators 50
3.10 Arithmetic Assignment Operators 51
3.11 Comparison and Logical Operators 52
3.12 Bitwise Operators 58
3.13 Bitwise Assignment Operators 62
3.14 Special Operators 63
3.15 Type Conversion 66
3.16 ANSI C++ Type Casting 68
3.17 Summary of ANSI C++ Operators 69
3.18 ANSI C++ Alternate Punctuation Tokens 71
Review Questions 71
Concept Review Questions 72
4. Input and Output Streams 75
4.1 Comments 75
4.2 Declaration of Variables 76
4.3 The Main () Function 77
4.4 Simple C++ Programs 77
4.5 Program Termination 79
4.6 Features of Iostream 80
4.7 Keyboard and Screen I/O 83
4.8 Manipulator Functions 86
4.9 Input and Output (I/O) Stream Flags 93
Review Questions 105
Concept Review Problems 106
Programming Exercises 111
5. Control Statements 112
5.1 Conditional Expressions 112
5.2 Loop Statements 132
5.3 Nested Control Structures 151
5.4 Breaking Control Statements 153
Review Questions 159
Concept Review Problems 160
Programming Exercises 176
Contents ix

6. Functions and Program Structures 179


6.1 Introduction 179
6.2 Defining a Function 180
6.3 The Return Statement 182
6.4 Function Prototypes 183
6.5 Types of User Defined Functions 185
6.6 Actual and Formal Arguments 198
6.7 Local VS Global Variables 200
6.8 Default Arguments 202
6.9 Structure of the C++ Program 205
6.10 Order of the Function Declaration 208
6.11 Mutually Invocated Functions 211
6.12 Nested Functions 212
6.13 Scope Rules 214
6.14 Side Effects 216
6.15 Storage Class Specifiers 217
6.16 Recursive Functions 226
6.17 Preprocessors 229
6.18 Header Files 235
6.19 Standard Functions 235
Review Questions 235
Concept Review Problems 236
Programming Exercises 247

7. Arrays 248
7.1 Introduction 248
7.2 Array Notation 249
7.3 Array Declaration 249
7.4 Array Initialisation 250
7.5 Processing with Arrays 252
7.6 Arrays and Functions 259
7.7 Multidimensional Arrays 266
7.8 Character Array 276
Review Questions 285
Concept Review Problems 286
Programming Exercises 291

8. Pointers and Strings 293


8.1 Introduction 293
8.2 Pointer Arithmetic 299
8.3 Pointers and Functions 305
8.4 Pointers to Functions 311
8.5 Passing a Function to Another Function 314
8.6 Pointers and Arrays 316
8.7 Arrays of Pointers 319
x Contents

8.8 Pointers and Strings 320


8.9 Pointers to Pointers 327
8.10 Deciphering Complex Declarations 329
Review Questions 331
Concept Review Problems 332
Programming Exercises 339

9. Structures, Unions and Bit Fields 340


9.1 Introduction 340
9.2 Declaration of a Structure 341
9.3 Processing with Structures 343
9.4 Initialisation of Structure 350
9.5 Functions and Structures 352
9.6 Arrays of Structures 357
9.7 Arrays within a Structure 361
9.8 Structures within a Structure (Nested Structure) 368
9.9 Pointers and Structures 375
9.10 Unions 379
9.11 Bit Fields 383
9.12 Typedef 386
9.13 Enumerations 389
Review Questions 391
Concept Review Problems 392
Programming Exercises 396

10. Classes and Objects 398


10.1 Introduction 398
10.2 Structures and Classes 399
10.3 Declaration of a Class 401
10.4 Member Functions 405
10.5 Defining the Object of a Class 407
10.6 Accessing a Member of Class 409
10.7 Array of Class Objects 423
10.8 Pointers and Classes 426
10.9 Unions and Classes 430
10.10 Classes within Classes (Nested Class) 432
10.11 Summary of Structures, Classes and Unions 439
Review Questions 440
Concept Review Problems 440
Programming Exercises 449

11. Special Member Functions 454


11.1 Introduction 454
11.2 Constructors 455
11.3 Destructors 470
Contents xi

11.4 Inline Member Functions 476


11.5 Static Class Members 481
11.6 Friend Functions 487
11.7 Dynamic Memory Allocations 496
11.8 This Pointer 502
11.9 Mutable 505
Review Questions 506
Concept Review Problems 506
Programming Exercises 513

12. Single and Multiple Inheritance 518


12.1 Introduction 518
12.2 Single Inheritance 520
12.3 Types of Base Classes 524
12.4 Types of Derivation 531
12.5 Ambiguity in Single Inheritance 534
12.6 Array of Class Objects and Single Inheritance 536
12.7 Multiple Inheritance 538
12.8 Container Classes 549
12.9 Member Access Control 552
12.10 Summary of the Inheritance Access Specifier 568
Review Questions 568
Concept Review Problems 569
Programming Exercises 581

13. Overloading Functions and Operators 584


13.1 Function Overloading 584
13.2 Operator Overloading 607
13.3 Overloading of Binary Operators 612
13.4 Overloading of Unary Operators 617
Review Questions 621
Concept Review Problems 622
Programming Exercises 632

14. Polymorphism and Virtual Functions 633


14.1 Polymorphism 633
14.2 Early Binding 634
14.3 Polymorphism with Pointers 638
14.4 Virtual Functions 641
14.5 Late Binding 644
14.6 Pure Virtual Functions 653
14.7 Abstract Base Classes 656
14.8 Constructors Under Inheritance 659
14.9 Destructors Under Inheritance 661
14.10 Virtual Destructors 664
xii Contents

14.11 Virtual Base Classes 668


Review Questions 673
Concept Review Problems 674
Programming Exercises 685

15. Templates, Namespace and Exception Handling 689


15.1 Function Template 689
15.2 Class Template 694
15.3 Overloading of Function Template 698
15.4 Exception Handling 703
15.5 Namespace 710
Review Questions 724
Concept Review Problems 725
Programming Exercises 735

16. Data File Operations 736


16.1 Opening and Closing of Files 736
16.2 Stream State Member Functions 738
16.3 Reading/Writing a Character from a File 740
16.4 Binary File Operations 745
16.5 Classes and File Operations 747
16.6 Structures and File Operations 753
16.7 Array of Class Objects and File Operations 754
16.8 Nested Classes and File Operations 757
16.9 Random Access File Processing 761
Review Questions 766
Programming Exercises 767

17. STL–Containers Library 768


17.1 Introduction 768
17.2 Vector Class 769
17.3 Double Ended Queue (Deque) Class 772
17.4 List Class 775
17.5 Stack Class 777
17.6 Queue Class 781
17.7 Priority_queue Class 786
17.8 Set 788
17.9 Multiset 789
17.10 Map 790
17.11 Multimap 792
17.12 Bitset 793
Review Questions 793

18. STL–Iterators and Allocators 795


18.1 Introduction 795
Contents xiii

18.2 Types of Iterators 796


18.3 <Iterator> Member Functions 796
18.4 Operators 800
18.5 Types of Iterator Classes 801
18.6 Summary of Iterator Classes 802
Review Questions 803

19. STL–Algorithms and Function Objects 804


19.1 Introduction 804
19.2 Non-modifying Sequence Algorithms 805
19.3 Modifying Sequence Algorithms 806
19.4 Sorted Sequence Algorithms 810
19.5 Heap Operation Algorithms 812
19.6 Comparison Algorithms 812
19.7 Permutation Algorithm 813
19.8 Numeric Algorithms 813
19.9 Function Objects 814
19.10 The Functional Members 814
Review Questions 818

Appendix 820
Bibliography 836
Index 838
Preface to the Third Edition

The book not only discusses the issues concerning the mystery of ANSI C++ but also makes a conscious
effort to relate those insights to contemporary programming. This timeless and enlightening information
is presented in a clear and concise manner. The new edition offers a fresh perspective of what ANSI C++
means and where ANSI C++ fits into the scheme of software life cycles. Thus, readers can gain requisite
expertise by acquiring ANSI C++ programming skills and design ideas.

Aim of the Book


A welcome introduction to the world of programming, this book discloses facts and techniques on ANSI/
ISO C++ and provides a knowledge base for advanced, standard-compliant, and efficient use of C++.
It not only covers the syntax and semantics of ANSI C++ but also reveals the secrets of object-oriented
programming through various topics, namely, classes, objects, inheritance, polymorphism and dynamic
binding, and generic programming through STL. It offers stimulating insights into the loftiest thoughts and
realisations of what ANSI C++ is and its relationship to modern software life cycles. A must read for all
those who want to increase their understanding and awareness of object-oriented programming concepts,
the book also serves the purpose of a handy reference for C++ programming professionals.

Users
The target audience for this book is two-fold—(i) computer novices who do not have any prior programming
knowledge, and (ii) experienced C++ developers who seek a guide for enhancing their design and
programming proficiency. Specifically, it can be used by undergraduate students of CSE, IT, ECE, EEE,
Electronics and Instrumentation Engineering, BCA/MCA, and BSc/MSc (Computer Science/IT). Moreover, it
would be an ideal reference for students of diploma and DOEACC courses in computer science and computer
training institutes.

New to the Edition


∑ Broader and in-depth coverage of Object Oriented Programming concepts in 2 new chapters—
Chapter 1: Introduction to Object Oriented Programming and Chapter 2: Building ANSI C++ Programs
∑ Detailed coverage of Standard Template Libraries (STL) in three new chapters—Chapters 17:
STL - Containers, Chapter 18: STL - Iterators and Chapter 19: STL - Algorithms and Function Objects
∑ Enhanced coverage for topics such as data types, arithmetic operators, IOStreams, functions and
program structures, special member functions, and exception handling
∑ Inclusion of new section on Namespaces in Chapter 15: Templates, Namespace and Exception Handling
xvi Preface to the Third Edition

Salient Features
The revised edition has been thoroughly updated with ANSI/ISO C++ syntax. This text offers one of
the best reviews of ANSI C++ since it gives access to the most important concepts in object-oriented
programming found anywhere. It introduces the syntax and features of C++ programming languages in
a simple manner. The concepts are very well exemplified with program codes containing the inputs and
outputs of the sample programs. It first explains the basic concepts (like functions, arrays, pointers and
structures) and then progresses with the discussion on OOP concepts (like classes, objects, inheritance,
polymorphism and templates) which will be helpful for the beginners in better understanding of the
implementation and applications of the C++ language.
The book is impregnated with the following salient features:
∑ Offers a concise introduction to C++ and Object-Oriented Programming (OOP).
∑ Emphasises the use of software tools and covers the software engineering topics in detail.
∑ Provides pictorial representation in the form of syntax diagrams, flowcharts and Object Modeling
Technique (OMT) class notation diagrams given.
∑ Elucidates the language features through executable codes which are tested on various compilers such
as Linux GNU C++ and .Net Microsoft Visual C++.
∑ Facilitates the readers with simple and easy-to-understand format of the program execution (i.e.,
sample input and output).
∑ Explains how to avoid and correct typical errors.
∑ Describes concept review problems to test programming proficiency of readers on various ANSI C++
topics in a special section. Interactive exercises using the computer make learning fun.
∑ Refreshed and enhanced pedagogy includes Programming Examples (359), Review Questions
(439), Concept Review Problems (380) and Programming Exercises (197). Answers to the
Concept Review Problems are included in the Appendix.
The pedagogical features and their benefits are explained below:

Highlights Description and Benefit Examples


Introduction Each chapter begins with an Introduction which helps the reader Refer pages
get a brief summary of the background and contents of the chapter. 1, 13, 32, etc.
Sections and Sub- Object-oriented programming using C++ is one of the most widely Refer pages
sections discussed, debated, and examined elements of modern software 35, 63, 79,
life cycles, and also one of the most mysterious and misunderstood etc.
subjects. Therefore, each chapter has been neatly divided into
sections and sub-sections so that the subject matter is studied in a
logical progression of ideas and concepts.
Programming code A set of programming codes, totaling to 314 problems is present in Refer pages
with sample input relevant chapters. All sample programs are well graded and tested 87, 130, 222,
and output using the different versions of the ANSI C++ compiler. etc.
These self-learning codes with sample inputs and outputs enable
students to strive towards better comprehension of the concepts and
also, master the programming skills.
Preface to the Third Edition xvii

Highlights Description and Benefit Examples


Flowcharts and Flowcharts and syntax diagrams presented at appropriate locations Refer pages
Diagrams demystify the complexity of the difficult topics like pointers, 114, 133, 141,
strings, streams, inheritance polymorphism, file handling, etc.
templates, etc. Object Modeling Technique (OMT) diagrams easily
illustrate the advance topics, functional relationships and definition
sketches for mathematical models.
Review Questions These are very useful for the faculty in setting class work, Refer pages
assignments, quizzes and examinations and help students in 13, 31, 71,
revising the learnt concepts. etc.
Programming This section takes an unbiased look at some of the more interesting Refer pages
Exercises and relevant ideas relating to programming. The practice questions 111, 176, 247,
help students get a clearer picture of the software design and etc.
coding.
Concept Review This section concentrates on a wide range of concepts such as Refer pages
Problems syntax and semantic analysis of the code, spotting and identifying 72, 105, 160,
the logical errors, technical and complexity analysis. This enhances etc.
your knowledge and understanding of software engineering and
also, improves your programming skills.
Answers to Concept Answers provided for all the Concept Review Problems at the end Refer pages
Review Problems of the book as Appendix A help check your understanding of the 820, etc.
learnt concepts.
References and A comprehensive list of references given at the end of the book Refer pages
Bibliography further enhances the subject knowledge. 836, etc.

Organisation
This book consists of nineteen chapters which are as follows:
Chapter 1 presents the concepts and features of Object-Oriented Programming (OOP) and highlights
some of the key terms of the OOP paradigm which are extensively used in this book.
Chapter 2 gives an overview of the latest addenda to ANSI/ISO C++ compiler and also suggests how
to build an ANSI C++ program under various platforms, namely, GNU C++ for Linux and .Net VC++ for
Windows.
Chapter 3 introduces the fundamentals of C++ programming language and summarises the most
significant data types, operators and expressions used in ANSI C++.
Chapter 4 focuses on developing simple C++ programs with emphasis on the Input and Output Streams
<iostream> and highlights the features of manipulator functions and Input and Output (I/O) stream flags.
Chapter 5 describes the principles and guidelines in the design and evolution of C++ through control
statements which has become the standard for any programming language.
Chapter 6 deals with user-defined functions and program structures and stresses on how to define
and use the different types of arguments (namely, actual, formal, local and global variables); how to use the
recursive functions, nested functions and preprocessors.
xviii Preface to the Third Edition

Chapter 7 explains the importance of array data types in C++. It describes how to define, declare and
use single dimensional, multidimensional and character arrays. Array notation, array initialisation and types
of data storage such as static, automatic, and free store are also dealt with numerous examples.
Chapter 8 delves on the syntax and semantics of pointer data type which is one of the strengths of the
C++ language. In addition, it demonstrates the use of strings and advanced memory management techniques
using complex pointer data types and also guides the user how to avoid common pointer related errors.
Chapter 9 deals with functional characteristics of structure and union data types. It also describes how
to declare, define and use the array of structure, structure within structure, pointer to structure, union tags
and bit fields.
Chapter 10 elucidates the salient features of object-oriented programming and explains how classes and
objects can be defined, declared and used in C++. Special attention is given for defining the various types
of class declarations.
Chapter 11 covers the syntax and semantics of the special member functions such as constructors,
destructors, inline member functions, static class members and friend functions as well as their role in
class design. It also demonstrates several techniques and guidelines for an effective usage of these special
member functions.
Chapter 12 discusses one of the most important features of the OOP, namely, inheritance. Single and
multiple inheritance, types of derivation, public inheritance, private inheritance, protected inheritance,
container classes and member access control are explained with suitable number of examples.
Chapter 13 exemplifies the concepts of function and operator overloading, and explores the benefits
as well as the potential problems of operator overloading. It discusses the restrictions that apply to operator
overloading and also explains how to avoid the common errors while using operator and function overloading.
Chapter 14 narrates the central attraction of the OOP—polymorphism with pointers and virtual
functions. Early binding, virtual functions, late binding, pure virtual functions, abstract base classes,
constructors under inheritance, destructors under inheritance, virtual destructors and virtual base classes are
presented, with well-graded examples.
Chapter 15 presents the various aspects of designing and implementing templates, including class
templates, function templates, and template issues that are of special concern. This chapter describes the
standard exception handling using the keywords—try, catch and throw. It also elucidates the rationale
behind the addition of namespaces to the language and the problems that namespaces solve. Furthermore,
how to declare, define and use the namespace alias, nested namespace, unnamed namespace and namespace
std, are covered in this chapter.
Chapter 16 gives the data file operations in C++ and focuses on how to read and write a class of
objects from the files of secondary storage devices. The ANSI-ISO C++ streams and file processing
commands are dealt with suitable illustrations.
Chapters 17–19 provide coverage on introduction to the Standard Template Library (STL) and
generic programming in general. It discusses the principles of generic programming, focusing on STL
as an exemplary framework of generic programming. These chapters also demonstrate the use of STL
components such as containers, algorithms, iterators, allocators, adapters, binders, and function objects.

Online Learning Center


The accompanying web supplement http://www.mhhe.com/ravichandran/cp3e provides an additional
resource for students and instructors.
Preface to the Third Edition xix

Acknowledgements
I am grateful to Dr T Sundararajan, Professor, Department of Civil Engineering, Pondicherry Engineering
College, for his timely support, encouragement, valuable comments, suggestions and many innovative ideas
in carrying out this project. I am indebted to my teachers, mentors and professors who taught me the art of
computer programming during my studentship at Indian Institute of Technology, Kharagpur, especially, to
Prof. Swapna Banerjee, Prof. N B Chakaraborthy and Prof. J C Biswas.
I extend my appreciation to Mr Christian Wolff, Heidelberg, Germany, for his continuous motivation, love
and advice in my life. I would like to express my gratitude towards Mr Arun, Mr Walid, Mr Shariq Ali and
Dr. Gulam Ahmed, Middle East College of Information Technology, Muscat, Sultanate of Oman, for their
technical comments and suggestions. I am thankful to my students [in India and abroad] who have helped
me a lot in bringing out this edition and would like to specially acknowledge the efforts of Mr Al Walid
Al Busaidi, Muscat; Mr Ashwin Kumar Chummun, UK; Mr Gowathaman, France; Mr Sampath Reddy,
US; Mr Sudheer Reddy, US; Mr Tushar Ranjan Sahoo and Dr Ram Niranjan Sahoo JIPMER, Pondicherry.
My earnest thanks are also due to the editorial and publishing professionals at Tata McGraw-Hill for
their keen interest and support in bringing out this book in record time. There have been several professors
who have participated in the review process of this book. I would like to sincerely acknowledge them for
their valuable suggestions and encouragement.

Akshay Girdhar
Guru Nanak Dev Engineering College, Ludhiana, Punjab
Amit Jain
Bharat Institute of Technology, Meerut, Uttar Pradesh
Harish Kumar
Panjab University, Chandigarh, Punjab
Prashant Sharma
Anand Engineering College, Agra, Uttar Pradesh
Dinesh Kumar Tyagi
Birla Institute of Technology and Science, Pilani, Rajasthan
Md Tanwiruddin Haider
National Institute of Technology, Patna, Bihar
Mahua Banerjee
Xavier Institute of Social Service, Ranchi, Jharkhand
xx Acknowledgements

N K Kamila
C V Raman College of Engineering, Bhubaneswar, Orissa
Pranam Paul
Dr B C Roy Engineering College, Kolkata, West Bengal
Sajal Mukhopadhya
National Institute of Technology, Durgapur, West Bengal
Kanhaiya Lal
Birla Institute of Technology, Patna, Bihar
Poornachandra Sarang
University of Mumbai, Mumbai, Maharashtra
Manisha J Somavanshi
Indira Institute of Management, Pune, Maharashtra
T V Gopal
Anna University, Chennai, Tamil Nadu
N Shanthi
K S Rangasamy college of Technology, Tiruchengode, Tamil Nadu
Annappa
National Institute of Technology, Surathkal, Karnataka
CH V K N S N Moorthy
R K Institute of Science and Technology, Hyderabad, Andhra Pradesh
M M Naidu
S V University College of Engineering, Tirupati, Andhra Pradesh
Finally, I thank my parents, son and wife for the love, encouragement and comfort they have
extended to me throughout my career.

D Ravichandran

Feedback
The readers of the book are encouraged to send their comments, queries and suggestions at
the following email id—tmh.csefeedback@gmail.com, mentioning the title and author name in the
subject line. Also, please report to us any piracy of the book spo ed by you.
Chapter
Introduction to Object
Oriented Programming 1
This chapter focuses on the definitions, basic concepts and salient features
of Object Oriented Programming (OOP). The pros and cons of Structured
Procedural Programming (SPP) with Object Oriented Programming (OOP) are
also summarised. Major applications of OOP are also highlighted in this chapter.
It also describes how C++ can be used to improve productivity and so ware
quality by offering features such as classes, objects, data hiding, encapsulation,
inheritance, polymorphism and templates.

1.1 INTRODUCTION

A major challenge for software engineering today is to improve the software programming process as
modern software life cycle has been changing very dramatically since the late nineties wherein the code
re-usability, reliability and maintainability are the key features. The very aim of using an object oriented
programming language is to handle a complex software design in a very easy, simple and efficient manner.
Redesigning and maintaining the source code costs much more than the reusability of the source code. The
turnover time and software cost are drastically brought down. The main aim of designing the C++ language
is to support both a procedure oriented style and an object oriented programming paradigm. In that sense,
C++ is a hybrid language which supporzts both the procedural as well as object oriented programming
styles.
Softwares designed using object oriented technology can meet up the challenges of large real world
systems by enhancing the ability to produce reliable and maintainable code. Through object oriented
programming and design, such software can naturally evolve to meet changing needs. To effectively
accomplish this, one must learn new ways of thinking about programming and problem solving.
Therefore, Object Technology (OT) is drawing attention and consideration in many areas of computing,
such as
∑ programming
∑ data bases
2 Programming with C++

∑ system analysis and design


∑ computer architecture
∑ operating systems
∑ expert systems, and
∑ internet client/server programming

1.2 WHAT IS OBJECT ORIENTED PROGRAMMING OOP ?

Object oriented programming, or OOP, is a software development philosophy based on the following
central ideas:
∑ encapsulation
∑ inheritance
∑ information hiding
∑ data abstraction and
∑ polymorphism
Object Oriented Programming has revolutionised the very art and practice of writing computer
applications. Object is the basic unit of object oriented programming. Designing an object-oriented model
involves defining a set of classes. A class is a template from which objects are created. The template, or
blueprint, provided by a class specifies a set of data and methods that all objects created according to its
specifications will contain.
Hence, the object oriented programming approach has the advantage of producing more reliable
softwares for complex and large-scale systems.

1.3 STRUCTURED PROCEDURAL PROGRAMMING SPP

In the late seventies, Structured Procedural Programming


(SPP) was widely used for designing and developing
softwares. Structured programming is a programming
paradigm that to a large extent relies on the idea of
dividing a program into functions and modules (Fig. 1.1).
As programs became larger for real life applications,
they were broken down into smaller units, such as functions,
procedures, and subroutines. Functions can be grouped
Fig. 1.1 Procedural Programming Approach
together into modules according to their functionality,
objectives and tasks. In other words, SPP emphasises mostly functional decomposition and procedural
abstraction for designing and developing software systems.
However, SPP was found to be unsuitable for handling complex software systems due to lack of code
reusability, extensibility and maintainability. One of the main drawbacks of SPP is that data and functions
have to be stored separately and the data has to be globally accessed, as the systems are modularised on the
basis of functions. Information hiding and data encapsulation are not supported in SPP and therefore, every
function can access every piece of data. Functions have unrestricted access to global data. Changing the
global data in a module causes program side effects and that code becomes unreliable and error prone in a
complex system.
Some of the examples for procedural languages are ‘C’, Pascal, and Fortran.
Introduction to Object Oriented Programming 3

It is well known that ‘C’ is widely accepted as a well structured programming language for a variety of
applications. It has many advantages over other high level programming languages. But it has flaws and
limitations that has made it unsuitable for complex programming projects.

1.4 OBJECT ORIENTED PROGRAMMING OOP


Object Oriented Programming (OOP) alleviates
some of the problems mentioned above. The
OOP approach has the advantage of producing
better structured and more reliable softwares
for complex systems, greater reusability, more
extensibility, and easy maintainability.
In object oriented programming, systems
are modularised on the basis of data structures
(objects). Object’s state (data types) and
behavior (operations) are encapsulated. Message
passing ensures that an object’s internal state can
be accessed only if permitted, as encapsulation
Fig. 1.2 Object Oriented Programming (OOP)
prevents unauthorised access (Fig. 1.2).
Approach
Real world is represented more closely by
objects mimicking external entities. Objects of the program interact by sending messages to each other.
Each object is responsible to initialise and destroy itself correctly. Consequently, there is no longer the
need to explicitly call a creation or termination procedure.

1.5 CHARACTERISTICS OF OOPs

Following are the major characteristics for considering any programming languages to be object oriented:
∑ objects
∑ classes
∑ data abstraction
∑ data encapsulation
∑ information hiding
∑ message passing
∑ inheritance
∑ dynamic binding
∑ polymorphism, and
∑ overloading

1.5.1 Objects
In Object Oriented Programming (OOP) paradigm, objects are the fundamental building blocks for
designing a software. In other words, an object is a collection of data members and the associated member
functions are known as methods. Objects are identified by its unique name (Fig. 1.3(b)). An object
represents a particular instance of a class. There can be more than one instance of an object. Each instance
of an object can hold its own relevant data.
Random documents with unrelated
content Scribd suggests to you:
The good-natured cousin said she would look after the baby,
while Francesca rode off down the street on her father's shoulder.
The donkeys had been put in the stable for their night's rest.
The party soon reached the Corso, which had been cleared of
carriages. Both sides were lined by an ever-growing crowd.
Just at sunset a gun was fired. Instantly a number of beautiful
horses were freed. They wore fine trappings and were without riders
or drivers. Down the Corso they raced from one end to the other. It
seemed as though they passed by like lightning.
"Good, good," shouted Beppo, as the first horse reached the goal.
This one was the winner of the race, of course.
"We can see this sport every night of the carnival," his father told
him, as they walked slowly homeward, looking at the sights on the
way.
Early the next morning Tessa and Beppo started off on their
donkeys once more. They did not wish to lose a moment of the day's
fun. They had many a mock battle with the children whom they met,
but the fighting was all good-natured, and the only weapons used
were handfuls of confetti.
In the afternoon they found themselves near Arthur and Lucy,
who were in an open carriage. They did not have their masks on, so
their friends spied them out very quickly. They were very glad to see
each other, but the crowd was so great they did not have a chance
to say much.
"Tessa," whispered Lucy, "father has something to ask your
parents. He was going to write to them if he did not see them before
the end of the carnival. Be sure to tell them. It is about you."
That was all she had a chance to say before the driver started up
the horses and she had passed on. Tessa wondered what it could be
about, but her mind was soon busy with the gay sights, and she
forgot all about it till she reached home.
The last night of the carnival was the gayest time of all. As soon
as it was dark, Tessa went with her father and mother and Beppo
out into the streets. Every one carried a torch and tried to keep it
lighted. At the same time he must try to put out as many other
torches as possible.
How the lights danced up and down the streets! What a puffing
and blowing there was all the time. Tessa no sooner got her torch
lighted than some one came up from behind and put it out. Then
she would cry, "Senza moccolo, senza moccolo." That means,
"Without light, without light."
After a while, Beppo fastened his torch to the end of a long pole.
He thought he was safe at last. But, no! a moment afterward some
one came along with a pole longer than his own and dashed it
down. The fun was all the greater for such little things as this.
The city looked wonderfully pretty with the lights dancing about
the windows and balconies and streets.
After an hour or two the crowds began to thin out. Every one was
tired. Tessa and Beppo turned homeward with their father and
mother, calling out:
"The carnival is dead. The carnival is dead."
Soon afterward they tumbled into bed, half asleep, still repeating
the words they heard echoing through the streets:
"The carnival is dead!"
CHAPTER IX.
THE BURIED CITY

"We should like to take your little daughter with us on a journey,"


said Mr. Gray to Tessa's father.
The two men were standing in the doorway of the artist's home
on the Monday after the carnival. Tessa had not forgotten to tell her
father that Mr. Gray wished to see him.
"We shall be gone only a few days. We are going to take a short
trip to Naples," the artist went on. "But Lucy wishes Tessa's
company very much, and I think your little girl would enjoy it. What
do you say?"
The peasant was greatly pleased. His face beamed, as he replied:
"You are a good friend to us, Mr. Gray. We can never forget it.
What shall we do when you go back to America?"
"That time will not come for two years yet. In the meanwhile, talk
with your wife. If she is willing, bring Tessa here Tuesday morning.
We shall leave on the afternoon of that day."
You can imagine how excited our little Italian cousin was, when
she found herself riding on a train for the first time. The cars were
much smaller than we use here in America. It would have seemed
odd to you to have the conductor (or the guard, as he is called in
Europe) lock the doors when the train is about to start.
"We are prisoners," laughed Lucy. "We can't get out now, even if
we should wish to do so ever so much."
She was now able to chatter in Italian almost as fast as in her
own English tongue.
"That is because of her acquaintance with Tessa and her brother,"
Mr. Gray told his wife. "Those children surprise me by the good
Italian they speak, when they have had so little schooling. Although
their parents are peasants, they are gentle people in their nature.
And that is more than learning, after all."
The children were delighted with Naples. The city rests on the
shore of what some people consider the most beautiful bay in the
world. Everything about it looked clean and orderly, although a few
years ago it was a very filthy city.
No one seemed in a hurry. Even the beggars, who came to meet
the children with hands stretched out for alms, looked lazy and
happy.
There were beautiful gardens to walk in, and fine buildings to
visit, besides rowing and sailing on the blue waters of the bay. There
was plenty to see, but best of all was the morning the children spent
in the museum, where there was a large collection of curiosities.
"They all came from the buried city," Mr. Gray explained.
"Think of it, children! These beautiful ornaments, vases, and
bronzes, were hidden under the ashes for eighteen hundred years.
One day it was discovered by some workman that he was digging
into the ruins of a building. Others came to help him, and by and by
they found a city beneath the ashes and soil which had formed
above it."
"You are going to take us to see the city before we go back to
Rome, aren't you, father?" asked Arthur.
"Certainly; I would not have you miss the sight for a good deal.
But does Tessa know its name?"
"O yes, it is Pompeii. I have heard much about it," the little Italian
answered. "It is another of the wonderful sights in my country of
which I am so proud."
The children passed slowly from one part of the museum to
another. They examined the almonds, dates, and figs, which had
been preserved so long. Some of them looked quite natural. There
was a lady's toilet set that interested the girls very much.
There were blackened loaves of bread and cake from the baker's
oven; there were beautiful lamps and golden jewelry,—all these
things made for people suddenly overtaken by death nearly two
thousand years ago!
It was hard to leave the museum.
"But there are other things to see yet, and we cannot spend too
much time in one place," Mr. Gray told them as they walked
homeward.
They stopped to buy some luscious yellow oranges and some
ornaments of coral and lava at stands by the side of the street.
That very evening ponies were brought to the hotel door, and the
party started out to climb the side of Vesuvius.
"I shouldn't think the people of Naples would feel safe to live so
near a volcano," said Lucy. "Now that it is active again, it must make
them think of the way Pompeii was destroyed. And Pompeii is
several miles away, isn't it, father?"
"Yes, there was no more thought of danger at that time than we
feel to-night. Perhaps not so much," he added, as he looked toward
his wife.
She was a little pale and was feeling more timid than she liked to
say. Up above them, even now, they could see the sky lighted up by
the red flame. It looked as though a city must be on fire. The path
wound in a roundabout way, but was always rising and was in some
places very steep and rocky.
"See that red stream of lava pouring down the side of the
mountain," said Arthur.
It was not so far away but that the children could see men at
work beside it. They were scooping the lava up into vessels. It would
be taken down to Naples and made into jewelry and ornaments to
be sold to visitors in the city.
After two miles or more of hard climbing, they reached the side of
the crater.
"Don't go too near. Oh, do be careful, children," cried Mrs. Gray.
She was trembling as she looked at the red-hot stones flying upward
in the midst of the cinders and flames.
"Listen, do listen, mother. It is grand!" said Lucy, as they could
now hear the roaring and grumbling, the pounding and hammering
under ground. It was as though some terrible being was an angry
prisoner in the volcano and was trying to free himself.
Tessa clung to Mrs. Gray's skirt at first. She was frightened, too,
and it was no wonder. But after a few moments both she and her
kind friend had got over their fright and had begun to enjoy the
strange sight.
"IT WAS A STRANGE PLACE"

When at last Mrs. Gray said it was time to go, they all felt sorry.
The drive down the mountain was quite easy. When they reached
the hotel the children went straight to bed to dream of the pleasure
to-morrow,—for they were to visit the buried city, Pompeii.
The next day was bright and clear. Although every one felt a little
tired after the excitement of the night before, they were all ready for
the day's trip.
It was a strange place, this city with no one living in it. There
were streets all laid out and the walls of houses standing. The roofs
were gone, however.
Mr. Gray explained to the children that the city was buried under
the terrible shower of ashes which settled down over it. The roofs
had been burnt or broken down by the weight above them. After a
while, soil formed above the ashes, grass began to grow, and the
rest of the world forgot about the city, once so beautiful, with its
stately palaces and grand buildings.
Most of the people had time to flee before their homes were
destroyed. But some of them stayed too long. Their skeletons were
found when the city was unearthed.
The children went into a cellar where there were marks on the
walls. The guide told them that these showed where people were
pressed against them. They must have fled to that place for safety,
but it had been of no use. They stood here prisoners until kind death
freed them from their suffering.
They saw many marble ornaments. There were ducks and geese,
rabbits and lambs, made long ago.
"All this makes me feel queer, Lucy," whispered Tessa. "I will be
glad to get back to a live city again." Lucy felt so, too. It was
interesting, of course, but it was very strange.
After the visit to Pompeii, Mr. Gray told the children that his
vacation was over and they must all go back to Rome.
"But we will not return by train," he said. "We will take a sailing
vessel, as I think you will enjoy a trip on the water."
They did enjoy it greatly. The only trouble was that it seemed too
short.
"When June comes it will be quite hot in Rome, you know," Lucy
said to Tessa. The two girls were in the bow of the boat, looking
over the edge into the water below.
"We are going then on a journey to the north of Italy, and you are
to come, too, Tessa. Father says so. We will visit Venice and sail in
boats through its streets. It seems as though I could hardly wait for
the time to come. Just think of a great city built on little islands, and
when you go to the door of your house you find yourself on the
water's edge. It must be lovely."
"Tessa," she went on, putting her arm around the little Italian's
waist, "father says that he is going to manage next winter so that
you shall stay with us and we can have lessons together with my
governess."
Tessa bent forward and kissed both of Lucy's hands. She was so
happy she could not speak.

THE END

L. C. Page and Company's


BOOKS FOR YOUNG PEOPLE

THE LITTLE COLONEL BOOKS


(Trade Mark)

By ANNIE FELLOWS JOHNSTON

Each 1 vol., large 12mo, cloth, illustrated, per vol. $1.50


THE LITTLE COLONEL STORIES
(Trade Mark)

Being three "Little Colonel" stories in the Cosy Corner Series, "The
Little Colonel," "Two Little Knights of Kentucky," and "The Giant
Scissors," put into a single volume.

THE LITTLE COLONEL'S HOUSE PARTY


(Trade Mark)

THE LITTLE COLONEL'S HOLIDAYS


(Trade Mark)

THE LITTLE COLONEL'S HERO


(Trade Mark)

THE LITTLE COLONEL AT BOARDING SCHOOL


(Trade Mark)

THE LITTLE COLONEL IN ARIZONA


(Trade Mark)

THE LITTLE COLONEL'S CHRISTMAS


VACATION
(Trade Mark)

THE LITTLE COLONEL, MAID OF HONOUR


(Trade Mark)
THE LITTLE COLONEL'S KNIGHT COMES
RIDING
(Trade Mark)

MARY WARE: THE LITTLE COLONEL'S CHUM


(Trade Mark)
These ten volumes, boxed as a ten-volume set. $15.00

THE LITTLE COLONEL


(Trade Mark)

TWO LITTLE KNIGHTS OF KENTUCKY

THE GIANT SCISSORS

BIG BROTHER
Special Holiday Editions
Each one volume, cloth decorative, small quarto, $1.25
New plates, handsomely illustrated with eight
full-page drawings in color, and many marginal
sketches.
IN THE DESERT OF WAITING: The Legend of Camelback
Mountain.
THE THREE WEAVERS: A Fairy Tale for Fathers and Mothers
as Well as for Their Daughters.

KEEPING TRYST

THE LEGEND OF THE BLEEDING HEART


THE RESCUE OF PRINCESS WINSOME: A Fairy Play
for Old and Young.

THE JESTER'S SWORD


Each one volume, tall 16mo, cloth decorative $0.50
Paper boards .35
There has been a constant demand for publication in separate
form of these six stories, which were originally included in six of the
"Little Colonel" books.
JOEL: A BOY OF GALILEE: By Annie Fellows Johnston.
Illustrated by L. J. Bridgman.
New illustrated edition, uniform with the Little Colonel Books, 1 vol.,
large 12mo, cloth decorative $1.50
A story of the time of Christ, which is one of the author's best-
known books.

THE LITTLE COLONEL GOOD TIMES BOOK


Uniform in size with the Little Colonel Series $1.50
Bound in white kid (morocco) and gold 3.00
Cover design and decorations by Amy Carol Rand.
The publishers have had many inquiries from readers of the Little
Colonel books as to where they could obtain a "Good Times Book"
such as Betty kept. Mrs. Johnston, who has for years kept such a
book herself, has gone enthusiastically into the matter of the
material and format for a similar book for her young readers. Every
girl will want to possess a "Good Times Book."

ASA HOLMES: Or, At the Cross-Roads. A sketch of Country Life


and Country Humor. By Annie Fellows Johnston.
With a frontispiece by Ernest Fosbery.
Large 16mo, cloth, gilt top $1.00
"'Asa Holmes; or, At the Cross-Roads' is the most delightful, most
sympathetic and wholesome book that has been published in a long
while."—Boston Times.

THE RIVAL CAMPERS: Or, The Adventures of Henry Burns.


By Ruel Perley Smith.
Square 12mo, cloth decorative, illustrated $1.50
A story of a party of typical American lads, courageous, alert, and
athletic, who spend a summer camping on an island off the Maine
coast.

THE RIVAL CAMPERS AFLOAT: Or, The Prize Yacht


Viking. By Ruel Perley Smith.
Square 12mo, cloth decorative, illustrated $1.50
This book is a continuation of the adventures of "The Rival
Campers" on their prize yacht Viking.

THE RIVAL CAMPERS ASHORE


By Ruel Perley Smith.
Square 12mo, cloth decorative, illustrated $1.50
"As interesting ashore as when afloat."—The Interior.

JACK HARVEY'S ADVENTURES: Or, The Rival Campers


Among the Oyster Pirates. By Ruel Perley Smith. Illustrated $1.50
"Just the type of book which is most popular with lads who are in
their early teens."—The Philadelphia Item.

PRISONERS OF FORTUNE: A Tale of the Massachusetts


Bay Colony. By Ruel Perley Smith.
Cloth decorative, with a colored frontispiece $1.50
"There is an atmosphere of old New England in the book, the
humor of the born raconteur about the hero, who tells his story with
the gravity of a preacher, but with a solemn humor that is
irresistible."—Courier-Journal.

FAMOUS CAVALRY LEADERS. By Charles H. L. Johnston.


Large 12mo. With 24 illustrations $1.50
Biographical sketches, with interesting anecdotes and
reminiscences of the heroes of history who were leaders of cavalry.
"More of such books should be written, books that acquaint
young readers with historical personages in a pleasant informal
way."—N. Y. Sun.

FAMOUS INDIAN CHIEFS. By Charles H. L. Johnston.


Large 12mo, illustrated $1.50
In this book Mr. Johnston gives interesting sketches of the Indian
braves who have figured with prominence in the history of our own
land, including Powhatan, the Indian Cæsar; Massasoit, the friend of
the Puritans; Pontiac, the red Napoleon; Tecumseh, the famous war
chief of the Shawnees; Sitting Bull, the famous war chief of the
Sioux; Geronimo, the renowned Apache Chief, etc., etc.

BILLY'S PRINCESS. By Helen Eggleston Haskell.


Cloth decorative, illustrated by Helen McCormick Kennedy $1.25
Billy Lewis was a small boy of energy and ambition, so when he
was left alone and unprotected, he simply started out to take care of
himself.

TENANTS OF THE TREES. By Clarence Hawkes.


Cloth decorative, illustrated in colors $1.50
"A book which will appeal to all who care for the hearty, healthy,
outdoor life of the country. The illustrations are particularly
attractive."—Boston Herald.

BEAUTIFUL JOE'S PARADISE: Or, The Island of


Brotherly Love. A sequel to "Beautiful Joe." By Marshall
Saunders, author of "Beautiful Joe."
One vol., library 12mo, cloth, illustrated $1.50
"This book revives the spirit of 'Beautiful Joe' capitally. It is fairly
riotous with fun, and is about as unusual as anything in the animal
book line that has seen the light."—Philadelphia Item.

'TILDA JANE. By Marshall Saunders.


One vol., 12mo, fully illustrated, cloth decorative, $1.50
"I cannot think of any better book for children than this. I
commend it unreservedly."—Cyrus Townsend Brady.

'TILDA JANE'S ORPHANS. A sequel to 'Tilda Jane. By


Marshall Saunders.
One vol., 12mo, fully illustrated, cloth decorative, $1.50
'Tilda Jane is the same original, delightful girl, and as fond of her
animal pets as ever.

THE STORY OF THE GRAVELEYS. By Marshall Saunders,


author of "Beautiful Joe's Paradise," "'Tilda Jane," etc.
Library 12mo, cloth decorative. Illustrated by E. B. Barry $1.50
Here we have the haps and mishaps, the trials and triumphs, of a
delightful New England family, of whose devotion and sturdiness it
will do the reader good to hear.

BORN TO THE BLUE. By Florence Kimball Russel.


12mo, cloth decorative, illustrated $1.25
The atmosphere of army life on the plains breathes on every page
of this delightful tale. The boy is the son of a captain of U. S. cavalry
stationed at a frontier post in the days when our regulars earned the
gratitude of a nation.

IN WEST POINT GRAY


By Florence Kimball Russel.
12mo, cloth decorative, illustrated $1.50
"Singularly enough one of the best books of the year for boys is
written by a woman and deals with life at West Point. The
presentment of life in the famous military academy whence so many
heroes have graduated is realistic and enjoyable."—New York Sun.

FROM CHEVRONS TO SHOULDER STRAPS


By Florence Kimball Russel.
12mo, cloth, illustrated, decorative $1.50
West Point again forms the background of a new volume in this
popular series, and relates the experience of Jack Stirling during his
junior and senior years.

THE SANDMAN: HIS FARM STORIES


By William J. Hopkins. With fifty illustrations by Ada Clendenin
Williamson.
Large 12mo, decorative cover $1.50
"An amusing, original book, written for the benefit of very small
children. It should be one of the most popular of the year's books for
reading to small children."—Buffalo Express.

THE SANDMAN: MORE FARM STORIES


By William J. Hopkins.
Large 12mo, decorative cover, fully illustrated $1.50
Mr. Hopkins's first essay at bedtime stories met with such
approval that this second book of "Sandman" tales was issued for
scores of eager children. Life on the farm, and out-of-doors, is
portrayed in his inimitable manner.
THE SANDMAN: HIS SHIP STORIES
By William J. Hopkins, author of "The Sandman: His Farm Stories,"
etc.
Large 12mo, decorative cover, fully illustrated $1.50
"Children call for these stories over and over again."—Chicago
Evening Post.

THE SANDMAN, HIS SEA STORIES


By William J. Hopkins.
Large 12mo, decorative cover, fully illustrated $1.50
Each year adds to the popularity of this unique series of stories to
be read to the little ones at bed time and at other times.

THE DOCTOR'S LITTLE GIRL


By Marion Ames Taggart, author of "Pussy-Cat Town," etc.
One vol., library, 12mo, illustrated $1.50
A thoroughly enjoyable tale of a little girl and her comrade father,
written in a delightful vein of sympathetic comprehension of the
child's point of view.

SWEET NANCY
The Further Adventures of the Doctor's Little Girl. By Marion Ames
Taggart.
One vol., library, 12mo, illustrated $1.50
In the new book, the author tells how Nancy becomes in fact "the
doctor's assistant," and continues to shed happiness around her.

THE CHRISTMAS-MAKERS' CLUB


By Edith A. Sawyer.
12mo, cloth decorative, illustrated $1.50
A delightful story for girls, full of the real spirit of Christmas. It
abounds in merrymaking and the right kind of fun.

CARLOTA
A Story of the San Gabriel Mission. By Frances Margaret Fox.
Square 12mo, cloth decorative, illustrated and decorated in colors by
Ethelind Ridgway $1.00
"It is a pleasure to recommend this little story as an entertaining
contribution to juvenile literature."—The New York Sun.

THE SEVEN CHRISTMAS CANDLES


By Frances Margaret Fox.
Square 12mo, cloth decorative, illustrated and decorated in colors by
Ethelind Ridgway $1.00
Miss Fox's new book deals with the fortunes of the delightful
Mulvaney children.

PUSSY-CAT TOWN
By Marion Ames Taggart.
Small quarto, cloth decorative, illustrated and decorated in colors
$1.00
"Anything more interesting than the doings of the cats in this
story, their humor, their wisdom, their patriotism, would be hard to
imagine."—Chicago Post.

THE ROSES OF SAINT ELIZABETH


By Jane Scott Woodruff.
Small quarto, cloth decorative, illustrated and decorated in colors by
Adelaide Everhart $1.00
This is a charming little story of a child whose father was
caretaker of the great castle of the Wartburg, where Saint Elizabeth
once had her home.

GABRIEL AND THE HOUR BOOK


By Evaleen Stein.
Small quarto, cloth decorative, illustrated and decorated in colors by
Adelaide Everhart $1.00
Gabriel was a loving, patient, little French lad, who assisted the
monks in the long ago days, when all the books were written and
illuminated by hand, in the monasteries.

THE ENCHANTED AUTOMOBILE


Translated from the French by Mary J. Safford
Small quarto, cloth decorative, illustrated and decorated in colors by
Edna M. Sawyer $1.00
"An up-to-date French fairy-tale which fairly radiates the spirit of
the hour,—unceasing diligence."—Chicago Record-Herald.

O-HEART-SAN
The Story of a Japanese Girl. By Helen Eggleston Haskell.
Small quarto, cloth decorative, illustrated and decorated in colors by
Frank P. Fairbanks $1.00
"The story comes straight from the heart of Japan. The shadow of
Fujiyama lies across it and from every page breathes the fragrance
of tea leaves, cherry blossoms and chrysanthemums."—The Chicago
Inter-Ocean.

THE YOUNG SECTION-HAND: Or, The Adventures of


Allan West. By Burton E. Stevenson.
Square 12mo, cloth decorative, illustrated $1.50
Mr. Stevenson's hero is a manly lad of sixteen, who is given a
chance as a section-hand on a big Western railroad, and whose
experiences are as real as they are thrilling.

THE YOUNG TRAIN DISPATCHER. By Burton E.


Stevenson.
Square 12mo, cloth decorative, illustrated $1.50
"A better book for boys has never left an American press."—
Springfield Union.

THE YOUNG TRAIN MASTER. By Burton E. Stevenson.


Square 12mo, cloth decorative, illustrated $1.50
"Nothing better in the way of a book of adventure for boys in
which the actualities of life are set forth in a practical way could be
devised or written."—Boston Herald.
CAPTAIN JACK LORIMER. By Winn Standish.
Square 12mo, cloth decorative, illustrated $1.50
Jack is a fine example of the all-around American high-school boy.

JACK LORIMER'S CHAMPIONS: Or, Sports on Land and


Lake. By Winn Standish.
Square 12mo, cloth decorative, illustrated $1.50
"It is exactly the sort of book to give a boy interested in athletics,
for it shows him what it means to always 'play fair.'"—Chicago
Tribune.

JACK LORIMER'S HOLIDAYS: Or, Millvale High in Camp.


By Winn Standish.
Illustrated $1.50
Full of just the kind of fun, sports and adventure to excite the
healthy minded youngster to emulation.

JACK LORIMER'S SUBSTITUTE: Or, The Acting Captain


of the Team. By Winn Standish.
Illustrated $1.50
On the sporting side, this book takes up football, wrestling,
tobogganing, but it is more of a school story perhaps than any of its
predecessors.

CAPTAIN JINKS: The Autobiography of a Shetland Pony. By


Frances Hodges White.
Cloth decorative, illustrated $1.50
The story of Captain Jinks and his faithful dog friend Billy, their
quaint conversations and their exciting adventures, will be eagerly
read by thousands of boys and girls. The story is beautifully written
and will take its place alongside of "Black Beauty" and "Beautiful
Joe."
THE RED FEATHERS. By Theodore Roberts.
Cloth decorative, illustrated $1.50
"The Red Feathers" tells of the remarkable adventures of an
Indian boy who lived in the Stone Age, many years ago, when the
world was young.

FLYING PLOVER. By Theodore Roberts.


Cloth decorative. Illustrated by Charles Livingston Bull $1.00
Squat-By-The-Fire is a very old and wise Indian who lives alone
with her grandson, "Flying Plover," to whom she tells the stories
each evening.

THE WRECK OF THE OCEAN QUEEN. By James Otis,


author of "Larry Hudson's Ambition," etc.
Cloth decorative, illustrated $1.50
"A stirring story of wreck and mutiny, which boys will find
especially absorbing. The many young admirers of James Otis will
not let this book escape them, for it fully equals its many
predecessors in excitement and sustained interest."—Chicago
Evening Post.

LITTLE WHITE INDIANS. By Fannie E. Ostrander.


Cloth decorative, illustrated $1.25
"A bright, interesting story which will appeal strongly to the
'make-believe' instinct in children, and will give them a healthy,
active interest in 'the simple life.'"

MARCHING WITH MORGAN. How Donald Lovell Became a


Soldier of theRevolution. By John L. Veasy.
Cloth decorative, illustrated $1.50
This is a splendid boy's story of the expedition of Montgomery
and Arnold against Quebec.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like