Libro De C++
Teach Yourself
C++
in 21 Days
FIFTH EDITION
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Sams Teach Yourself C++ in 21 Days, Fifth Edition
Copyright © 2005 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying,recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the informationcontained herein. International Standard Book Number: 0-672-32711-2 Library of Congress Catalog Card Number: 2004096713 Printed in the United States of America First Printing: December 2004 07 06 05 04 4 3 2 1
ASSOCIATE PUBLISHER
Michael Stephens
ACQUISITIONS EDITOR
Loretta Yates
DEVELOPMENT EDITOR
Songlin Qiu
MANAGING EDITOR
Charlotte Clapp
PROJECT EDITOR
Seth Kerney
COPYEDITOR
Karen Annett
INDEXER
Erika Millen
PROOFREADER
Paula Lowell
TECHNICAL EDITORS
Mark Cashman David V. Corbin
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting thevalidity of any trademark or service mark.
PUBLISHING COORDINATOR
Cindy Teeters
MULTIMEDIA DEVELOPER
Dan Scherf
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an “as is” basis. The authors and the publisher shall have neither liability nor responsibility toany person or entity with respect to any loss or damages arising from the information contained in this book.
BOOK DESIGNER
Gary Adair
PAGE LAYOUT
Eric S. Miller Julie Parks
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact U.S. Corporate and Government Sales1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales international@pearsoned.com
Contents at a Glance
Introduction Week 1 At a Glance Day 1 2 3 4 5 6 7 Getting Started The Anatomy of a C++ Program Working with Variables and Constants Creating Expressions and Statements Organizing into Functions Understanding Object-Oriented ProgrammingMore on Program Flow 1 3 5 25 41 67 99 137 175 209 219 221 255 289 329 371 407 449 491 503 505 537 593 637 659 715 751
Week 1 In Review Week 2 At a Glance Day 8 9 10 11 12 13 14 Understanding Pointers Exploiting References Working with Advanced Functions Object-Oriented Analysis and Design Implementing Inheritance Managing Arrays and Strings Polymorphism
Week 2 In Review Week 3 At aGlance Day 15 16 17 18 19 20 21 Special Classes and Functions Advanced Inheritance Working with Streams Creating and Using Namespaces Templates Handling Errors and Exceptions What’s Next
Week 3 In Review Appendixes Appendix A B C D E Working with Numbers: Binary and Hexadecimal C++ Keywords Operator Precedence Answers A Look at Linked Lists Index
791
807 817 819 821 875 887
ContentsIntroduction 1 Who Should Read This Book ..................................................................................1 Conventions Used in This Book ..............................................................................1 Sample Code for This Book ....................................................................................2 Week 1 At a Glance 3
A Note to C Programmers...
Regístrate para leer el documento completo.