C++学习笔记coursera(4/6)

课程名称:C for Everyone: Programming Fundamentals
课程内容:C/C++
课程网址:https://www.coursera.org/learn/c-for-everyone/home/week/1
课程进度:Week4

Week4

Function definition
Quote引用,引述
Pseudo伪,假的,冒充的
Coherent连贯的,有条理的
Crucial关键的
Encapsulation封装
Precondition前提postcondition后置条件
Arbitrary任意的
Abbreviate(v.)缩写
If a function’s return type is void, the function does not need any return statement.
the function exits at the end of its compound statement/block definition.

Function code example
Consequence后果,结果,重要性
Critical关键的
Interleave插入,夹进

Return statement
Explicit明确的
Clarity(n.)清楚,清晰
Stylistically风格上
Cube立方体,立方,三次幂
Messy混乱的,凌乱的
Internally内部地
When the return statement has an integer expression and the function return type is double,there is a conversion from int to double.

Function prototype
Prototype原型,最初形态
Overloading a functions重载函数
Ellipsis(n.)省略,省略号
Argument list参数列表
a function prototype allows a function declaration to precede a definition

Function Prototype-code example
在这里插入图片描述
Nested(v.)嵌套(adj.)嵌套的
Trivially琐碎地,平凡地
Interval间隔,间隙
Evaluation评价,评估,估计,定值,计值
Divide and conquer

Function variables-with call-by-value explained
Invocation调用 invoke调用
Notion概念,观念
For(;n>0;n–)
Semantic语义的
Argument list参数列表 parameter参数
Implicit不直接言明的,含蓄的
Explicit明确的
Substitute取代,接替,替代
Local version对surrounding environment声明的不产生影响,比如声明的int在calling environment里转换成double或者值改变,出来依然是int值不变
Encounter遇到,遭遇

Function definitions and scope rules
Nested嵌套的
Parallel平行的
Nomenclature命名法
Critical关键的
Variable的Lifetime看所在的block层次
Lifetime it only exists as long as the function is being executed
Innerblock
Outerblock
Innermost block
Heap(n.)堆

Storage class code example
Extern int reps = 0; 在函数外声明,全局变量在整个程序中都可以调用
Static int called = 0; 动态的,在函数里声明,调用函数就会确实地变化值(在全局中都体现)
Auto int I = 1;
Const int limit = 10; 值不能变
在这里插入图片描述
在这里插入图片描述
Diverge(v.)分歧,偏离
Index指数,索引,指标,标志
using a local to a function static variable,its value is retained upon function exit

Simple recursion
Recursion递归 recursive递归的
Fascinate(v.)迷住,入迷,深深吸引
Elementary基本的,基础的,简单的
Frequently(adv.)经常,频繁地
Iteration迭代
Array阵列,数组
Routine(n.)常规,例行程序(adj.)常规的,日常的,例行公事的
在recursion function里,有一个base case,base case如果成立需要做…,如果不成立需要做recursion
Recursive case也叫general case 配合 base case 使用
Terminate终止,结束
Mathematical induction数学归纳法
Prove证明,证实
Function main()也可以被called recursively,however it is not common to do so

Recursion-factorial code
Factorial阶乘
Scheme计划,规划,方案
Quantity数量,量
Long 一般是8bytes,64bits,能支持20阶乘
Accumulate积累
Generalized普遍的,全面的,概括性的
Backwards(adv.)向后,倒着,朝反方向
Inductive归纳的
doubles on most systems only give you 6 significant figures.如果用double算阶乘There would be problems with accuracy.

Recursion Fibonacci code(File included +)
Recurse递归
Fibonacci sequence
Exponentially(adv.)以指数方式
Precision精确,准确
Retain保持,保留
Summation总和,总结
Formula公式,配方,计划
Routine常规,例行程序
Irrespective无关的
Previous以前的,上一个的,上一次的
Abort中止
Ultimately最终
Pitfall陷阱,隐患,困难
Versus与…相对,与…相比
Recursion比iteration更消耗time and space

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值