




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1 目录目录 第1章 C 编程基础 Basic C Programming 1 1 如何撰写 C 程序 1 2 对象的定义与初始化 1 3 撰写表达式 Expressions 1 4 条件 Conditaional 语句和循环 Loop 语句 1 5 如何运用 Arrays 数组 和 Vectors 向量 1 6 指针带来弹性 1 7 档案的读写 第2章 面向过程的编程风格 Procedural Programming 2 1 如何撰写函数 2 2 调用 invoking 一个函数 2 3 提供默认参数值 Default Parameter Values 2 4 使用局部静态对象 Local Static Objects 2 5 声明一个 inline 函数 2 6 供应重载化函数 Overloaded Functions 2 7 定义并使用 Template Functions 模板函数 2 8 函式函数指针 Pointers to Functions 带来更大的弹性 2 9 设定表头档头文件 Header Files 第3章 泛型编程风格 Generic Programming 3 1 指针的数学运算 3 2 了解 Iterators 泛型指针 3 3 所有容器的共通操作 3 4 使用循序式容器 Sequential Containers 3 5 使用泛型算法 3 6 如何设计一个泛型算法 3 7 使用 Map 3 8 使用 Set 3 9 如何使用 Iterator Inserters 3 10 使用 iostream Iterators 第4章 以对象为基础 Object Based 的编程风格 4 1 如何实现一个 Class 4 2 什么是 Constructors 构造函数 和 Destructors 析构函数 4 3 何谓 mutable 可变 和 const 不变 4 4 什么是 this 指针 4 5 Static Class Member 静态的类成员 2 4 6 打造一个 Iterator Class 4 7 合作关系必须建立在友谊的基础上 4 8 实现一个 copy assignment operator 4 9 实现一个 function object 4 10 将 iostream 运算符重载 4 11 指针 指向 Class Member Functions 第5章 面向对象 Object Oriented 编程风格 5 1面向对象 Object Oriented 编程概念 5 2 漫游 面向对象编程思维 5 3 不带继承的多态 Polymorphism without Inheritance 5 4 定义一个抽象基类 Abstract Base Class 5 5 定义一个派生类 Derived Class 5 6 运用继承体系 Using an Inheritance Hierarchy 5 7 基类应该多么抽象 5 8 初始化 解构 与复制 Initialization Destruction an Copy 5 9 在派生类中定义一个虚拟函数 5 10执行期的型别鉴定机制 Run Time Type Identification 第6章 以 template 进行编程 6 1 被参数化的型别 Parameterized Types 6 2 Class Template 的定义 6 3 Tempalte 型别参数 type parameters 的处理 6 4 实作一个 Class Template 6 5 一个以 Function Template 完成的 Output 运算符 6 6 常量表达式 Constant Expressions 与默认参数值 Default Parameters 6 7 以 Template 参数作为一种设计策略 6 8 Member Tempalte Functions 第7章 异常处理 Exception Handling 7 1 抛出异常 Throwing an Exception 7 2 捕捉异常 Catching an Exception 7 3 提炼异常 Trying for an Exception 7 4 局部资源的管理 7 5 标准异常 The Standard Exceptions 附录 A 习题解答 附录 B 泛型算法手册 Generic Algorithms Handbook 附录 C 中英术语对照 侯捷 索引 3 英文 台湾惯用术语 大陆惯用术语 abstract 抽象的 抽象的 abstraction 抽象体 抽象物 抽象性 抽象体 抽象物 抽象性 access 存取 取用 存取 访问 access function 存取函式 存取函数 address of operator 取址运算子 cout is also flushed when the program ends normally 一段用来存放数据的存储区域 IO 设备常存储输入 或输出 到缓冲区 并独立于程序 动作对缓冲区进行读写 输出缓冲区通常必须显式刷新以强制输出缓冲区内容 默认情况 下 读 cin 会刷新 cout 当程序正常结束时 cout 也被刷新 built in type 内置类型 内置类型 A type such as int defined by the language C 语言本身定义的类型 如 int cerr ostream object tied to the standard error which is often the same stream as the standard output By default writes to cerr are not buffered Usually used for error messages or other output that is not part of the normal logic of the program 绑定到标准错误的 ostream 对象 这通常是与标准输出相同的流 默认情况下 输出 cerr 不缓冲 通常用于不是程序正常逻辑部分的错误信息或其他输出 cin istream object used to read from the standard input 用于从标准输入中读入的 istream 对象 class C mechanism for defining our own data structures The class is one of the most fundamental features in C Library types such as istream and ostream are classes 用于自定义数据结构的 C 机制 类是 C 中最基本的特征 标准库类型 如 istream 和 ostream 都是类 10 class type A type defined by a class The name of the type is the class name 由类所定义的类型 类型名就是类名 clog ostream object tied to the standard error By default writes to clog are buffered Usually used to report information about program execution to a log file 绑定到标准错误的 ostream 对象 默认情况下 写到 clog 时是带缓冲的 通常用于将程 序执行信息写入到日志文件中 comments 注释 注释 Program text that is ignored by the compiler C has two kinds of comments single line and paired Single line comments start with a Everything from the to the end of the line is a comment Paired comments begin with a and include all text up to the next 编译器会忽略的程序文本 C 有单行注释和成对注释两种类型的注释 单行注释以 开头 从 到行的结尾是一条注释 成对注释以 开始包括到下一个 为止的所有文 本 condition 条件 条件 An expression that is evaluated as true or false An arithmetic expression that evaluates to zero is false any other value yields true 求值为真或假的表达式 值为 0 的算术表达式是假 其他所有非 0 值都是真 cout ostream object used to write to the standard output ordinarily used to write the output of a program 用于写入到标准输出的 ostream 对象 一般情况下用于程序的输出 curly brace 花括号 花括号 Curly braces delimit blocks An open curly starts a block a close curly ends one 花括号对语句块定界 左花括号 开始一个块 右花括号 结束块 data structure 数据结构 数据结构 A logical grouping of data and operations on that data 数据及数据上操作的逻辑组合 edit compile debug 编辑 编辑 编译编译 调试 调试 The process of getting a program to execute properly 使得程序正确执行的过程 11 end of file 文件结束符 文件结束符 System specific marker in a file that indicates that there is no more input in the file 文件中与特定系统有关的标记 表示这个文件中不再有其他输入 expression 表达式 表达式 an The smallest unit of computation An expression consists of one or more operands and usually an operator Expressions are evaluated to produce a result For example assuming i and j are ints then i j is an arithmetic addition expression d yields the sum of the two int values Expressions are covered in more detail in Chapter 5 最小的计算单元 表达式包含一个或多个操作数并经常含有一个操作符 表达式被求值并 产生一个结果 例如 假定 i 和 j 都为 int 型 则 i j 是一个算术加法表达式并求这 两个 int 值的和 表达式将在第五章详细介绍 for statement for 语句 语句 Control statement that provides iterative execution Often used to step through a data structure or to repeat a calculation a fixed number of times 提供迭代执行的控制语句 通常用于步进遍历数据结构或对一个计算重复固定次数 function 函数 函数 A named unit of computation 有名字的计算单元 function body 函数体 函数体 Statement block that defines the actions performed by a function 定义函数所执行的动作的语句块 function name 函数名 函数名 Name by which a function is known and can be called 函数的名字标识 函数通过函数名调用 header 头文件 头文件 A mechanism whereby the definitions of a class or other names may be made available to multiple programs A header is included in a program through a include directive 使得类或其他名字的定义在多个程序中可用的一种机制 程序中通过 include 指示包含 头文件 if statement if 语句 语句 Conditional execution based on the value of a specified condition If the condition is true the if body is executed If not control flows to the statement following the else if there is one or to the 12 statement following the if if there is no else 根据指定条件的值执行的语句 如果条件为真 则执行 if 语句体 否则控制流执行 else 后面的语句 如果没有 else 将执行 if 后面的语句 iostream 输入输出流 输入输出流 library type providing stream oriented input and output 提供面向流的输入和输出的标准库类型 istream 输入流 输入流 Library type providing stream oriented input 提供面向流的输入的标准库类型 library type 标准库类型 标准库类型 A type such as istream defined by the standard library 标准库所定义的类型 如 istream main function 主函数 主函数 Function called by the operating system when executing a C program Each program must have one and only one function named main 执行 C 程序时 操作系统调用的函数 每一个程序有且仅有一个主函数 main manipulator 操纵符 操纵符 Object such as std endl that when read or written manipulates the stream itself Section A 3 1 p 825 covers manipulators in more detail 在读或写时 操纵 流本身的对象 如 std endl A 3 1 节详细讲述操纵符 member function 成员函数 成员函数 Operation defined by a class Member functions ordinarily are called to operate on a specific object 类定义的操作 成员函数通常在特定的对象上进行操作 method 方法 方法 Synonym for member function 成员函数的同义词 namespace 命名空间 命名空间 Mechanism for putting names defined by a library into a single place Namespaces help avoid inadvertent name clashes The names defined by the C library are in the namespace std 将库所定义的名字放至单独一个地方的机制 命名空间有助于避免无意的命名冲突 C 标准库所定义的名字在命名空间 std 中 13 ostream 输出流 输出流 Library type providing stream oriented output 提供面向流的输出的库类型 parameter list 形参表 形参表 Part of the definition of a function Possibly empty list that specifies what arguments can be used to call the function 函数定义的组成部分 指明可以用什么参数来调用函数 可能为空 preprocessor directive 预处理指示 预处理指示 An instruction to the C preprocessor include is a preprocessor directive Preprocessor directives must appear on a single line We ll learn more about the preprocessor in Section 2 9 2 C 预处理器的指示 include 是一个预处理器指示 预处理器指示必须出现在单独的 行中 第 2 9 2 节将对预处理器作详细的介绍 return type 返回类型 返回类型 Type of the value returned by a function 函数返回值的类型 source file 源文件 源文件 Term used to describe a file that contains a C program 用来描述包含在 C 程序中的文件的术语 standard error 标准错误 标准错误 An output stream intended for use for error reporting ordinarily on a windowing operating system the standard output and the standard error are tied to the window in which the program is executed 用于错误报告的输出流 通常 在视窗操作系统中 将标准输出和标准错误绑定到程序的 执行窗口 standard input 标准输入 标准输入 The input stream that ordinarily is associated by the operating system with the window in which the program executes 和程序执行窗口相关联的输入流 通常这种关联由操作系统设定 standard library 标准库 标准库 Collection of types and functions that every C compiler must support The library provides a rich set of capabilities including the types that support IO C programmers tend to talk about the library meaning the entire standard library or about particular parts of the library by 14 referring to a library type For example programmers also refer to the iostream library meaning the part of the standard library defined by the iostream classes 每个 C 编译器必须支持的类型和函数的集合 标准库提供了强大的功能 包括支持 IO 的类型 C 程序员谈到的 标准库 是指整个标准库 当提到某个标准库类型时也 指标准库中某个特定的部分 例如 程序员提到的 iostream 库 专指标准库中由 iostream 类定义的那部分 standard output 标准输出 标准输出 The output stream that ordinarily is associated by the operating system with the window in which the program executes 和程序执行窗口相关联的输出流 通常这种关联由操作系统设定 statement 语句 语句 The smallest independent unit in a C program It is analogous to a sentence in a natural language Statements in C generally end in semicolons C 程序中最小的独立单元 类似于自然语言中的句子 C 中的语句一般以分号结束 std Name of the namespace used by the standard library std cout indicates that we re using the name cout defined in the std namespace 标准库命名空间的名字 std cout 表明正在使用定义在 std 命名空间中的名字 cout string literal 字符串字面值 字符串字面值 Sequence of characters enclosed in double quotes 以双引号括起来的字符序列 uninitialized variable 未初始化变量 未初始化变量 Variable that has no initial value specified There are no uninitialized variables of class type Variables of class type for which no initial value is specified are initialized as specified by the class definition You must give a value to an uninitialized variable before attempting to use the variable s value Uninitialized variables can be a rich source of bugs 没有指定初始值的变量 类类型没有未初始化变量 没有指定初始值的类类型变量由类定 义初始化 在使用变量值之前必须给未初始化的变量赋值 未初始化变量是造成 bug 的主 要原因之一 variable 变量 变量 A named object 有名字的对象 15 while statement while 语句 语句 An iterative control statement that executes the statement that is the while body as long as a specified condition is true The body is executed zero or more times depending on the truth value of the condition 一种迭代控制语句 只要指定的条件为真就执行 while 循环体 while 循环体执行0次还 是多次 依赖于条件的真值 operator 操作符操作符 The call operator A pair of parentheses following a function name The operator causes a function to be invoked Arguments to the function may be passed inside the parentheses 调用操作符 跟在函数名后且成对出现的圆括号 该操作符导致函数被调用 给函数的实 参可在括号里传递 operator 操作符 操作符 Increment operator Adds one to the operand i is equivalent to i i 1 自增操作符 将操作数加 1 i 等价于 i i 1 operator 操作符 操作符 A compound assignment operator Adds right hand operand to the left and stores the result back into the left hand operand a b is equivalent to a a b 复合赋值操作符 将右操作数和左操作数相加 并将结果存储到左操作数中 a b 等价 于 a a b operator 操作符 操作符 Dot operator Takes two operands the left hand operand is an object and the right is the name of a member of that object The operator fetches that member from the named object 点操作符 接受两个操作数 左操作数是一个对象 而右边是该对象的一个成员的名字 这个操作符从指定对象中取得成员 operator 操作符 操作符 Scope operator We ll see more about scope in Chapter 2 Among other uses the scope operator is used to access names in a namespace For example std cout says to use the name cout from the namespace std 作用域操作符 在第二章中 我们将看到更多关于作用域的介绍 在其他的使用过程中 操作符用于在命名空间中访问名字 例如 std cout 表示使用命名空间 std 中的名字 cout operator 操作符 操作符 Assigns the value of the right hand operand to the object denoted by the left hand operand 表示把右操作数的值赋给左操作数表示的对象 16 operator 操作符 操作符 Output operator Writes the right hand operand to
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 钽铌压制成型工上岗考核试卷及答案
- 钒铁浸滤工前沿技术考核试卷及答案
- 水解物料中和工5S管理考核试卷及答案
- 居家残疾人托养服务推广工作计划
- 本册综合教学设计-2025-2026学年高中地理选修4中图版
- 部编版小学语文四年级能力提升计划
- 砖瓦原料工岗位操作技能考核试卷及答案
- 加湿软麻工前沿技术考核试卷及答案
- 2025标准商业停车场租赁合同
- 珍珠岩加工工应急处置考核试卷及答案
- 2024年新人教版部编本二年级上册美术教学工作计划及教学进度5
- DL∕T 1281-2013 燃煤电厂固体废物贮存处置场污染控制技术规范
- 《心房颤动诊断和治疗中国指南2023》-抗凝解读
- DZ∕T 0033-2020 固体矿产地质勘查报告编写规范(正式版)
- 模块化箱式房屋安装及验收技术标准2
- 健康讲座:颈椎病
- NY-T 3213-2023 植保无人驾驶航空器 质量评价技术规范
- 金融数据分析 课件 欧阳资生 第1-5章 导论、金融时间序列线性模型 -极值事件
- 刀工刀法与烹饪技艺
- 桁吊操作培训课件
- 柔性电子材料的突破与发展
评论
0/150
提交评论