没有合适的资源?快使用搜索试试~ 我知道了~
首页Sams Teach Yourself C++ in 24 Hours(5th) 无水印原版pdf
Sams Teach Yourself C++ in 24 Hours(5th) 英文无水印原版pdf 第5版 pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
资源详情
资源评论
资源推荐
ptg
ptg
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Jesse Liberty
Rogers Cadenhead
Sams Teach Yourself
24
in
Hours
C++
ptg
Sams Teach Yourself C++ in 24 Hours
Copyright © 2011 by Pearson Education, Inc.
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 information contained herein.
ISBN-13: 978-0-672-33331-6
ISBN-10: 0-672-33331-7
Printed in the United States of America
First Printing April 2011
Library of Congress Cataloging-in-Publication data is on file.
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.
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 or from the use of the
CD or programs accompanying it.
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
Editor in Chief
Mark Taub
Acquisitions Editor
Mark Taber
Development
Editor
Songlin Qiu
Managing Editor
Sandra Schroeder
Project Editor
Mandie Frank
Copy Editor
Keith Cline
Indexer
Lisa Stumpf
Proofreader
Leslie Joseph
Technical Editor
Jon Upchurch
Publishing
Coordinator
Vanessa Evans
Media Producer
Dan Scherf
Designer
Gary Adair
Compositor
Mark Shirar
ptg
Table of Contents
Introduction 1
Part I: Beginning C++
HOUR 1: Writing Your First Program 5
Using C++ . .................................................................................................................................................................. 5
Finding a Compiler. ............................................................................................................................................. 6
Compiling and Linking the Source Code . ....................................................................................... 9
Creating Your First Program ..................................................................................................................... 10
HOUR 2: Organizing the Parts of a Program 15
Reasons to Use C++ . ......................................................................................................................................... 15
The Parts of a Program . .............................................................................................................................. 19
Comments. ............................................................................................................................................................... 22
Functions . ............................................................................................................................................................... 23
HOUR 3: Creating Variables and Constants 29
What Is a Variable?. ......................................................................................................................................... 29
Defining a Variable. ......................................................................................................................................... 33
Assigning Values to Variables . ................................................................................................................ 35
Using Type Definitions. .................................................................................................................................. 36
Constants . ............................................................................................................................................................... 37
HOUR 4: Using Expressions, Statements, and Operators 43
Statements. ............................................................................................................................................................... 43
Expressions . ........................................................................................................................................................... 44
Operators . ............................................................................................................................................................... 45
If-Else Conditional Statements . ......................................................................................................... 53
Logical Operators . ............................................................................................................................................. 56
Tricky Expression Values . ........................................................................................................................... 58
ptg
iv
Sams Teach Yourself C++ in 24 Hours
HOUR 5: Calling Functions 63
What Is a Function? . ...................................................................................................................................... 63
Declaring and Defining Functions . ..................................................................................................... 64
Using Variables with Functions . ............................................................................................................ 66
Function Parameters . ...................................................................................................................................... 69
Returning Values from Functions. ......................................................................................................... 70
Default Function Parameters . ................................................................................................................ 72
Overloading Functions. .................................................................................................................................. 74
HOUR 6: Controlling the Flow of a Program 81
Looping . .................................................................................................................................................................. 81
while Loops. ........................................................................................................................................................... 81
do-while Loops . ................................................................................................................................................ 85
for Loops . ............................................................................................................................................................... 86
switch Statements . ......................................................................................................................................... 90
HOUR 7: Storing Information in Arrays and Strings 97
What Is an Array? . ......................................................................................................................................... 97
Writing Past the End of Arrays . ............................................................................................................ 99
Initializing Arrays . ......................................................................................................................................... 100
Multidimensional Arrays . ....................................................................................................................... 101
Character Arrays. ............................................................................................................................................. 104
Copying Strings . ............................................................................................................................................. 106
Part II: Classes
HOUR 8: Creating Basic Classes 111
What Is a Type? . ............................................................................................................................................. 111
Creating New Types. ...................................................................................................................................... 112
Classes and Members. .................................................................................................................................. 112
Accessing Class Members . ....................................................................................................................... 114
Private Versus Public Access . ................................................................................................................ 115
Implementing Member Functions . .................................................................................................. 116
Creating and Deleting Objects. ............................................................................................................ 118
剩余457页未读,继续阅读
yinkaisheng-nj
- 粉丝: 763
- 资源: 6952
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1