Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Vice President and Editorial Director: Marcia J. Horton
Editor-in-Chief: Michael Hirsch
Associate Editor: Carole Snyder
Vice President, Marketing: Patrice Jones
Marketing Manager: Yezan Alayan
Senior Marketing Coordinator: Kathryn Ferranti
Vice President, Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Associate Managing Editor: Robert Engelhardt
Operations Specialist: Lisa McDowell
Art Director: Linda Knowle
Cover Design: Abbey S. Deitel, Harvey M. Deitel, Marta Samsel
Cover Photo Credit: © James Hardy/PhotoAlto/Getty Images
Media Editor: Daniel Sandin
Media Project Manager: Wanda Rockwell
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on page vi.
The authors and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The authors and publisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation contained in this book. The authors and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs.
Copyright © 2012, 2008, 2005, 2003, 2001 Pearson Education, Inc., publishing as Prentice Hall.
All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright, and permission should 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(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, 501 Boylston Street, Suite 900, Boston, Massachusetts 02116.
Many of the designations 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 in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data
Deitel, Paul J.
   C++ : how to program / P.J. Deitel, H.M. Deitel. -- 8th ed.
            p. cm.
   Includes index.
   ISBN 978-0-13-266236-9
 1.  C++ (Computer program language)  I. Deitel, Harvey M. II. Title.
   QA76.73.C153D45 2012
   005.13’3--dc22
                                                                                                     2011000245
10 9 8 7 6 5 4 3 2 1
ISBN-13: 978-0-13-266236-9
Prentice Hall is an imprint of
DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, Inc.
Microsoft and the Windows logo are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
UNIX is a registered trademark of The Open Group.
Throughout this book, trademarks are used. Rather than put a trademark symbol in every occurrence of a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit of the trademark owner, with no intention of infringement of the trademark.
In memory of Ken Olsen,
Founder of Digital Equipment Corporation (DEC):
We are deeply grateful for the opportunities DEC extended to us, enabling us to form and grow Deitel & Associates, Inc.
—Paul and Harvey Deitel