`
yuanyu5237
  • 浏览: 159347 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

C++教程59 函数模板

 
阅读更多

 

#include <iostream>
using namespace std;

template <class FIRST, class SECOND>
FIRST smaller(FIRST a, SECOND b)
{
		return (a<b?a:b);
}


int main(){
	int x = 89;
	double y = 56.78;

	cout << smaller(x, y) << endl;

}

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics