#include<iostream>usingnamespacestd;
template<class T>
class compare
{
public:compare(T a, T b);T min();T max();
private:T num1;T num2;
};
template<class T>
compare<T>::compare(T a, T b)
{num1 = a;num2 = b;
}
template<class T>
T compare<T>::min()
{if (num1 > num2)return num2;elsereturn num1;}
template<class T>
T compare<T>::max()
{if (num1 > num2)return num1;elsereturn num2;
}int main()
{compare<int> com1(20, 10);cout << "the min of the number" << com1.min() << endl;cout << "the max of the number" << com1.max() << endl;compare < double> com2(15.6, 13.8);cout << "the min of the min number" << com2.min() << endl;cout << "the max of the number" << com2.max() << endl;system("pause");return0;
}