#include<iostream>
using namespace std;
//用模板实现输出两个数当中最小的值
template<class T>
T tmin( T x, T y)
{
return x<y?x:y;
}
void main()
{
int a = 5,b = 10;
float c = 3.1415 , d = 6.5536;
char e = 'a', f = 'c';
cout << "a,b 当中最小的数是:" << tmin(a,b) << endl;
cout << "c,d 当中最小的数是:" << tmin(c,d) << endl;
cout << "e,f 当中最小的数是:" << tmin(e,f) << endl;
}
标签:std,两个,函数,namespace,大小,return,模板 From: https://www.cnblogs.com/littleboss/p/16829925.html