今天弄了twitter这个鸟东东,并注册了跟gmail同名的用户名
2008-03-09 18:09
281 查看
Why define your own functions?
Readability
Maintainability
Code reuse
Function delaration should be be set before function invocation.
Returning a value
Up to one value may be returned
Must be the same type as the return type
No need to be at the end
Returns the value as soon as a return statement is executed
Fucntion overloading
Function prototypes are generally put into separate header files.
Recursion
Functions can call themselves
base case
recursive step
Pass by value(a) vs pass by reference(&a)
Readability
Maintainability
Code reuse
#include <iostream> using namespace std; int raiseToPower(int base, int exponent) { int result = 1; for (int i = 0; i < exponent; i = i + 1) { result = result * base; } return result; } int main() { int threeExpFour = raiseToPower(3, 4); cout << "3^4 is " << threeExpFour << endl; return 0; }
Function delaration should be be set before function invocation.
Returning a value
Up to one value may be returned
Must be the same type as the return type
No need to be at the end
Returns the value as soon as a return statement is executed
Fucntion overloading
void printOnNewLine(int x) { cout << "1 Integer: " << x << endl; } void printOnNewLine(int x, int y) { cout << "2 Integers: " << x << " and " << y << endl; }
Function prototypes are generally put into separate header files.
Recursion
Functions can call themselves
base case
recursive step
Pass by value(a) vs pass by reference(&a)
相关文章推荐
- 今天又到此一游,原因,是为了寻找传说中的Team foundation server,很难找呀,这个东东。
- 今天注册了个blog,试试这个东西到底怎么样
- 今天刚注册了这个博客,心理好高兴
- 今天在CSDN注册了这个blog,同时开始自己的游戏程序学习的旅程
- 修改XP注册到用户名和公司组织名
- Struts框架中利用jquery/ajax 验证用户名是否为空,是否已注册
- Ajax验证用户名是否已经注册(Servlet实现)
- 使用ASP.NET Atlas开发实时验证用户名是否被注册的自定义Behavior
- 今天我申请了这个账号
- 注册时:js的ajax实现局部刷新验证用户名
- ASP.NET自动检测用户名是否注册(利用微软AJAX控件技术)
- 使用sharedPreferences实现密码登录和注册用户名重复检查
- 注册用户名字符长度判断细节
- 应用ajax实现检测注册用户名是否已经存在
- 今天终于注册上了
- 我今天就要离开我的这个公司了 不知道什么时候才能更新blog
- 天啊,三鹿今天出事,央视面子往哪搁?《每周质量报告》还权威吗?这个节目还能做下去吗?
- 今天我新注册了博客
- 今天在CDN注册了~~~~
- 使用updatepanel局部刷新实现注册时对用户名的检测示例