ITeye博客

C++教程59 函数模板

yuanyu5237 · 2014-07-03 15:07 · C/C++ · 编程语言 · Markdown

#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;

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。