C++ by example
Every day, more and more people learn and use the C++ program-
ming language. I have taught C to thousands of students in my life.
I see many of those students now moving to C++ in their school work
or career. The C++ language is becoming an industry-accepted
standard programming language, using the solid foundation of C to
gain a foothold. C++ is simply a better C than C.
C++ By Example is one of several books in Que’s new line of By
Example series. The philosophy of these books is simple: The best
way to teach computer programming concepts is with multiple
examples. Command descriptions, format syntax, and language
references are not enough to teach a newcomer a programming
language. Only by looking at numerous examples and by running
sample programs can programming students get more than just a
“feel” for the language.
Who Should Use This Book
This book teaches at three levels: beginning, intermediate, and
advanced. Text and numerous examples are aimed at each level. If
you are new to C++, and even if you are new to computers, this book
attempts to put you at ease and gradually build your C++ program-
ming skills. If you are an expert at C++, this book provides a few
extras for you along the way.
The Book’s Philosophy
This book focuses on programming correctly in C++ by teaching
structured programming techniques and proper program design.
Emphasis is always placed on a program’s readability rather than
“tricks of the trade” code examples. In this changing world, pro-
grams should be clear, properly structured, and well-documented,
and this book does not waver from the importance of this philos-
This book teaches you C++ using a holistic approach. In addi-
tion to learning the mechanics of the language, you learn tips and
warnings, how to use C++ for different types of applications, and a
little of the history and interesting asides about the computing
Many other books build single applications, adding to them a
little at a time with each chapter. The chapters of this book are stand-
alone chapters, and show you complete programs that fully demon-
strate the commands discussed in the chapter. There is a program for
every level of reader, from beginning to advanced.
This book contains almost 200 sample program listings. These
programs show ways that you can use C++ for personal finance,
school and business record keeping, math and science, and general-
purpose applications that almost everybody with a computer can
use. This wide variety of programs show you that C++ is a very
powerful language that is easy to learn and use.
Appendix F, “The Mailing List Application,” is a complete
application—much longer than any of the other programs in the
book—that brings together your entire working knowledge of C++.
The application is a computerized mailing-list manager. Through-
out the chapters that come before the program, you learn how each
command in the program works. You can modify the program to
better suit your own needs. (The comments in the program suggest
changes you can make.)