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;

}

 

 

 

 

你可能感兴趣的:(C++)