function template
来源:互联网 发布:海康摄像机网络不可达 编辑:程序博客网 时间:2024/05/22 08:14
这应该是c++相对于c很有进步性的一个新元素,应该是从函数重载发展而来的,难度倒是没有,也挺好理解,主要是熟练。贴一个超小的模板程序。
//function template
#include <iostream.h>
template < class T >
T maximum( T a, T b, T c )
{
T max = a;
if ( b > max )
max = b;
if ( c > max )
max = c;
return max;
}
int main()
{
int int1, int2, int3;
cout << "input three integer values: ";
cin >> int1 >> int2 >> int3;
cout << "the maximum number is: "
<< maximum( int1, int2, int3 );
float in1, in2, in3;
cout << "/ninput three float values: ";
cin >> in1 >> in2 >> in3;
cout << "the maximum number is: "
<< maximum( in1, in2, in3 ) << endl;
return 0;
}
- function template
- function template
- C++ Template Function
- function template函数模版
- 14.2 - Function template instances
- template classes or function
- C++ template ——function template
- Function Template和css utility function
- 【C++】template vs virtual function
- 函数模板(Function Template)
- C++函数模板(function template)
- ejs template call nodejs function
- function template application in class
- C++ function template name binding
- jQuery String Template Format Function
- template programming学习(2) ---- function template arguments type deduction
- c++中的模板技术一:Function Template
- Template function无法偏特化及其解决方法.
- 利用Rational XDE中模式的能力来促进软件的重用
- 如何控制客户需求过渡膨胀?
- "游泳和CMM" "swimming & CMM"
- 软件小开发团体运用CMM思想进行过程改进
- 防止项目延迟的18条军规(转)
- function template
- 微软Bug管理
- 深入浅出门面模式
- CListCtrl使用详解
- .NET资源站点汇总
- 选择供应商时的该与不该
- 杀毒历程
- VSS使用手册
- 写的一个简单的分割字符串的函数(附原码)