Stephen R. Davis is the bestselling author of numerous books and
articles, including C# For Dummies. He has been programming for over
30 years and currently works for Booz Allen Hamilton in the area of
Homeland Defense.
Cover Image: ©iStockphoto.com/gavni
Go to Dummies.com®
for videos, step-by-step examples,
how-to articles, or to shop!
Open the book and find:
•How to create your first
program in Code::Blocks
•Mathematical and logical
operations
•An introduction to pointers
•What you need to know about
object-oriented programming
•How to use the copy constructor
•Ways to handle errors and keep
your program from being
hacked
•A companion website that
features all the code from
the book
$29.99 USA / $35.99 CAN / £21.99 UK
9 781118 823774
52999
ISBN:978-1-118-82377-4
Computers/Programming Languages/C
The bestselling guide that
shows you how to master
C++ from the ground up
Whether you’re a beginner or intermediate programmer
looking to fine-tune your skills, C++ For Dummies gives you
clear instructions and guidance on becoming a functional
C++ programmer. Updated to reflect the latest changes
for C++ 2014, this hands-on guide shows you how to make
sense of classes, inheritance, and advanced strokes—and
much more.
•C++Programming101—findoutwhatitmeanstowritea
computerprogram,learntospeaktheC++language,and
startcrunchingC++commands
•Putthe“fun”infunctionalprogramming—builduponyour
newly-gainedknowledgetobundlesectionsofC++codeinto
modules,andthenreusethosemodulesinprograms
•Theplotthickens—getthescooponobject-oriented
programingandgraspclasses,constructors,destructors,
andmuchmore
•Flyfirstclass—understandwhyinheritanceisthekeyto
effectiveC++programming,andbecomeafirst-rateobject-
orientedprogrammer
•Becomeamasterprogrammer—takeyourskillstothenext
levelandmasterfeatureslikefileinput/output,error-handling,
constructs,andtemplates
C++
Davis
7th Edition
Stephen R. Davis
Bestselling author of C# For Dummies
Learnto:
Program in C++ from the ground up
Write your first program in C++
Work with master classes and
inheritance
Sail through streaming I/O
C++
7thEdition
MakingEverythingEasier!
www.allitebooks.com
Start with FREE Cheat Sheets
Cheat Sheets include
 •Checklists
 •Charts
 •CommonInstructions
 •AndOtherGoodStuff!
Get Smart at Dummies.com
Dummies.com makes your life easier with 1,000s
of answers on everything from removing wallpaper
to using the latest version of Windows.
Check out our
 •Videos
 •IllustratedArticles
 •Step-by-StepInstructions
Plus, each month you can win valuable prizes by entering
our Dummies.com sweepstakes. *
Want a weekly dose of Dummies? Sign up for Newsletters on
 •DigitalPhotography
 •MicrosoftWindows&Office
 •PersonalFinance&Investing
 •Health&Wellness
 •Computing,iPods&CellPhones
 •eBay
 •Internet
 •Food,Home&Garden
Find out “HOW” at Dummies.com
*Sweepstakes not currently available in all countries; visit Dummies.com for official rules.
Get More and Do More at Dummies.com®
To access the Cheat Sheet created specifically for this book, go to
www.dummies.com/cheatsheet/cplusplus
www.facebook.com/fordummies
www.twitter.com/fordummies
From eLearning to e-books, test prep to test banks,
language learning to video training, mobile apps, and more,
Dummies makes learning easier.
At home, at work, or on the go,
Dummies is here to help you
go digital!
www.allitebooks.com
C++
7th Edition
by Stephen R. Davis
www.allitebooks.com
C++ For Dummies®
, 7th Edition
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2014 by John Wiley & Sons, Inc., Hoboken, New Jersey
Media and software compilation copyright © 2014 by John Wiley & Sons, Inc. All rights reserved.
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted
under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the
Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department,
John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at
http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and
related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be
used without written permission. All other trademarks are the property of their respective owners. John
Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO
REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF
THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING
WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY
MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND
STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS
SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL,
ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED,
THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE
PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT
THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A
POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE
PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR
RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET
WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS
WORK WAS WRITTEN AND WHEN IT IS READ. FULFILLMENT OF EACH COUPON OFFER IS THE SOLE
RESPONSIBILITY OF THE OFFEROR.
For general information on our other products and services, please contact our Customer Care Department
within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support,
please visit www.wiley.com/techsupport.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material
included with standard print versions of this book may not be included in e-books or in print-on-demand. If
this book refers to media such as a CD or DVD that is not included in the version you purchased, you may
download this material at http://booksupport.wiley.com. For more information about Wiley prod-
ucts, visit www.wiley.com.
Library of Congress Control Number: 2013958400
ISBN 978-1-118-82377-4 (pbk); ISBN 978-1-118-82382-8 (ebk); ISBN 978-1-118-82383-5 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
www.allitebooks.com
Contents at a Glance
Introduction ................................................................ 1
Part I: Getting Started with C++ Programming .............. 7
Chapter 1: Writing Your First C++ Program....................................................................9
Chapter 2: Declaring Variables Constantly...................................................................33
Chapter 3: Performing Mathematical Operations ........................................................47
Chapter 4: Performing Logical Operations ................................................................... 53
Chapter 5: Controlling Program Flow ............................................................................69
Part II: Becoming a Functional C++Programmer ......... 87
Chapter 6: Creating Functions........................................................................................89
Chapter 7: Storing Sequences in Arrays .....................................................................105
Chapter 8: Taking a First Look at C++ Pointers ..........................................................121
Chapter 9: Taking a Second Look at C++Pointers .....................................................135
Chapter 10: The C++ Preprocessor ..............................................................................153
Part III: Introduction to Classes ................................ 167
Chapter 11: Examining Object-Oriented Programming .............................................169
Chapter 12: Adding Class to C++ ..................................................................................175
Chapter 13: Point and Stare at Objects ....................................................................... 191
Chapter 14: Protecting Members: Do Not Disturb .....................................................207
Chapter 15: “Why Do You Build Me Up, Just toTear Me Down, Baby?”.................215
Chapter 16: Making Constructive Arguments ............................................................225
Chapter 17: The Copy/Move Constructor ..................................................................247
Chapter 18: Static Members: Can Fabric Softener Help? ..........................................261
Part IV: Inheritance ................................................. 271
Chapter 19: Inheriting a Class ......................................................................................273
Chapter 20: Examining Virtual Member Functions: Are They for Real? .................281
Chapter 21: Factoring Classes ...................................................................................... 291
Part V: Security ....................................................... 301
Chapter 22: A New Assignment Operator, Should You Decide to Accept It ..........303
Chapter 23: Using Stream I/O .......................................................................................315
Chapter 24: Handling Errors—Exceptions ................................................................337
www.allitebooks.com
1 / 477 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !