Teach Yourself C++ in 21 Days - 5th Ed [Sams 2005].pdf

(6826 KB) Pobierz
Jesse Liberty
Bradley Jones
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, photo-
copying, recording, or otherwise, without written permission from the pub-
lisher. 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 information contained 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
A
SSOCIATE
P
UBLISHER
Michael Stephens
A
CQUISITIONS
E
DITOR
Loretta Yates
D
EVELOPMENT
E
DITOR
Songlin Qiu
M
ANAGING
E
DITOR
Charlotte Clapp
P
ROJECT
E
DITOR
Seth Kerney
C
OPY
E
DITOR
Karen Annett
I
NDEXER
Erika Millen
P
ROOFREADER
Paula Lowell
T
ECHNICAL
E
DITORS
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 the validity of any trademark or service mark.
P
UBLISHING
C
OORDINATOR
Cindy Teeters
M
ULTIMEDIA
D
EVELOPER
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 to any person or entity with respect to any loss or damages
arising from the information contained in this book.
B
OOK
D
ESIGNER
Gary Adair
P
AGE
L
AYOUT
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 Sales
1-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 Programming
More 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 a Glance
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
Zgłoś jeśli naruszono regulamin