Programming Principles and Practice Using C++ (2nd Edition) - Bjarne Stroustrup [2014].pdf

(61728 KB) Pobierz
About This eBook
ePUB is an open, industry-standard format for eBooks. However, support of ePUB and its many features varies across
reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you
can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click
or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device
manufacturer’s Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the
eBook in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and
configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print
book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a “Click here
to view code image” link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the
Back button on your device or app.
Programming: Principles and Practice Using C++
Second Edition
Bjarne Stroustrup
Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where
those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed
with initial capital letters or in all capitals.
A complete list of photo sources and credits appears on pages
1273–1274.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any
kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic
versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests),
please contact our corporate sales department at
corpsales@pearsoned.com
or (800) 382-3419.
For government sales inquiries, please contact
governmentsales@pearsoned.com.
For questions about sales outside the United States, please contact
international@pearsoned.com.
Visit us on the Web:
informit.com/aw
Library of Congress Cataloging-in-Publication Data
Stroustrup, Bjarne, author.
Programming : principles and practice using C++ / Bjarne Stroustrup. — Second edition.
pages cm
Includes bibliographical references and index.
ISBN 978-0-321-99278-9 (pbk. : alk. paper)
1. C++ (Computer program language) I. Title.
QA76.73.C153S82 2014
005.13'3—dc23
2014004197
Copyright © 2014 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be
obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this
work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle
River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-99278-9
ISBN-10: 0-321-99278-4
Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana.
First printing, May 2014
Contents
Preface
Chapter 0 Notes to the Reader
0.1 The structure of this book
0.1.1 General approach
0.1.2 Drills, exercises, etc.
0.1.3 What comes after this book?
0.2 A philosophy of teaching and learning
0.2.1 The order of topics
0.2.2 Programming and programming language
0.2.3 Portability
0.3 Programming and computer science
0.4 Creativity and problem solving
0.5 Request for feedback
0.6 References
0.7 Biographies
Bjarne Stroustrup
Lawrence “Pete” Petersen
Chapter 1 Computers, People, and Programming
1.1 Introduction
1.2 Software
1.3 People
1.4 Computer science
1.5 Computers are everywhere
1.5.1 Screens and no screens
1.5.2 Shipping
1.5.3 Telecommunications
1.5.4 Medicine
1.5.5 Information
1.5.6 A vertical view
1.5.7 So what?
1.6 Ideals for programmers
Part I The Basics
Chapter 2 Hello, World!
2.1 Programs
2.2 The classic first program
2.3 Compilation
2.4 Linking
2.5 Programming environments
Chapter 3 Objects, Types, and Values
3.1 Input
3.2 Variables
Zgłoś jeśli naruszono regulamin