




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Copyright 2004 Scott/Jones Publishing,Alternate Version of STARTING OUT WITH C+ 4th Edition,Chapter 2Introduction to C+,Chapter 2 slide 2,Variable Assignment vs. Initialization,Initializing a variableGives an initial value to a variable at the time it is createdCan initialize some or all variablesint length; int length = 12; length = 12;,Chapter 2 slide 3,2.14 Scope,The scope of a variableThat part of the program where the variable can be usedA variable cannot be used before it is definedint a;cin a; / legalcin b; / illegalint b;,Chapter 2 slide 4,2.15 Arithmetic Operators,Used for performing numeric calculationsC+ has unary, binary, and ternary operators unary (1 operand) -5binary (2 operands) 13 - 7ternary (3 operands) exp1 ? exp2 : exp3,Chapter 2 slide 5,Binary Arithmetic Operators,Chapter 2 slide 6,/ Operator,C+ division operator (/)performs integer division if both operands are integerscout 13 / 5; / displays 2cout 2 / 4; / displays 0If either operand is floating-point, the result is floating-pointcout 13 / 5.0; / displays 2.6cout 2.0 / 4; / displays 0.5,Chapter 2 slide 7,% Operator,C+ modulus operator (%) computes the remainder resulting from integer divisioncout 9 % 2; / displa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 高校乒乓球教学中体美融合的路径探索
- 2019年城乡学校结对帮扶工作总结范文(二篇)
- 2025年挂职熬炼工作总结-
- 中国古风风格模板34
- 病区护理质量管理分析
- 乒乓球兴趣小组特色活动计划
- 小学五年级上册地方课程教学专题计划
- 肾内护理疑难病例讨论
- 化妆品质检部职责体系
- 高血压高危护理查房
- 《纸飞机的秘密》课件
- 口腔消毒培训
- UG练习图纸大全-65张-绝对受用
- 保安队长的培训
- 开曼群岛公司法2024版中文译本(含2024年修订主要内容)
- 2024年中级经济师《经济基础》考试真题及参考答案
- 抢救车及抢救药品管理
- 2024年10月自考14237手机媒体概论试题及答案
- 《中国糖尿病防治指南(2024版)》更新要点解读
- 新产品需求评估申请表
- 消防安全工作的资金投入和组织保障方案
评论
0/150
提交评论