#include<iostream>
using namespace std;
template<typename T,int size=4>
class CValue
{
public:
    T max(T ary[])
    {
      T max_val = 0;        //保存最大值的变量
      for( int i=0; i<size; i++)      //遍历数组
      {
        if( ary[i] > max_val )    //如果当前元素比当前最大值大
         {
           max_val = ary[i];     //修改保存最大值变量
         }
      }
    return max_val;          //返回最大值
    }
private:
    T ary[size];
};

int main()
{
	CValue<int> c1;
	int i_ary[4];
	cout<<"please input four integers:"<<endl;
	for(int i=0;i<4;i++)
	{
		cin>>i_ary[i];
	};
	cout<<"the i_max="<<c1.max(i_ary)<<endl;
	CValue<double> c2;
	double d_ary[4];
	cout<<"please input four doubles:"<<endl;
	for(int i=0;i<4;i++)
	{
		cin>>d_ary[i];
	};
	cout<<"the d_max="<<c2.max(d_ary)<<endl;
	return 0;
}