Function Template with multiple parameters
#include <iostream> using namespace std; template <class TFirst, class TSecond> //returns smaller number TFirst smaller(TFirst A, TSecond B) { return (A<B?A:B); //if A is less then B then return A; if not, return B } int main() { int x = 58; double y = 56.78; std::cout << smaller(x, y) << endl; //TFisrt = int, TSecond = double std::cout << smaller(y, x) << endl; //TFisrt = double, TSecond = int }