上一篇:站在面相对象角度小议C++ >>
Learn c++ step by step
通过这个例子边可以看出区别,而且注意一定要用标准C++的样式
打好基础
#include <iostream>
#include <cstdlib>
using namespace std;
int add1CallByValue(int t); //define function prototype
void add1ByPointer(int* t);
void add1ByReferrence(int& t);
int main(void)
{
int count=12;
std::cout<<"add1CallByValue";
add1CallByValue(count); //call by value
std::cout<<count<<endl;
std::cout<<"add1CallByPointer";
add1ByPointer(&count); //call by pointer
std::cout<<count<<endl;
std::cout<<"add1ByReferrence";
add1ByReferrence(count); //call by referrence
std::cout<<count<<endl;
system("pause");
return(0);
}
int add1CallByValue(int t)
{
return(t+1);
}
void add1ByPointer(int* p)
{
*p+=1;
}
void add1ByReferrence(int& t)
{
t+=1;
}
下一篇:Learn C++ step by step(2) >>
相关文章:
- · VC实现屏幕变暗效果
- · InstallShield6.3安装文件制作要点
- · GeoTiff探索成果总结
- · MapObject控件的使用之加入图层
- · 学好VC++的十大良好习惯
- · MapObject控件的使用之图层操作
- · C++的函数和模板函数
- · 使用c++实现Format函数
- · 读者——写者问题
- · MapObject控件的使用之符号绘制
- · 窗口的无效区域 演示程序
- · c++异常处理
- · 软件生态危机
- · 使用Sniffer截获流经本机网卡的IP数据包
- · 《深入浅出MFC》读书笔记(一,二)
- · 消息钩子函数入门篇
- · 利用HOOK拦截封包原理
- · 使用C++(I386+)编译一个纯二进制文件
- · 使用ScopeGuard在运行环境中监测内部变量
- · 如何学习java
- · 借助VMware实现单机使用WinDbg
- · 实现窗体自动隐藏(c代码)
- · 任意规模指派问题的C++类实现
- · Delphi数据库应用程序常见错误
- · 数据结构学习(C++)续——排序【4】选择排序
- · 一个类数据类型的STL例子
- · Windows内存机制解析(二)源代码
- · 平台+插件软件设计思想源代码说明
- · Winamp输入模块编写详解
- · 对错一点间
- · 资源释放
- · boost::any源代码分析
- · STL 简介,标准模板库[1]
- · STL 简介,标准模板库[2]
- · C++性能测试用例
- · 大学书信选1(关于编译器)
- · Loading HTML content from a Stream
- · 类设计系列 --- 析构函数篇
