#include<iostream>
using namespace std;
template <class Type> //函数模板
Type max(Type *Array,int n)
{ int i,j=0;
for (i=1;i<n-1;i++)
if (Array[i]>Array[j])
{ j=i; }
return Array[j];
}
int main()
{ int Array1[]={11,12,13,14,17,8,119};
double Array2[]={11.1,10.3,14.6,16.5,116.3,81.7,92.1};
cout<<max(Array1,7)<<endl;
cout<<max(Array2,7)<<endl;
system("pause");
return 0;
}
using namespace std;
template <class Type> //函数模板
Type max(Type *Array,int n)
{ int i,j=0;
for (i=1;i<n-1;i++)
if (Array[i]>Array[j])
{ j=i; }
return Array[j];
}
int main()
{ int Array1[]={11,12,13,14,17,8,119};
double Array2[]={11.1,10.3,14.6,16.5,116.3,81.7,92.1};
cout<<max(Array1,7)<<endl;
cout<<max(Array2,7)<<endl;
system("pause");
return 0;
}