#include <iostream>
using namespace std;
template<typename T>
T max(T x ,T y,T z){
if(z>x)
x=z;
if(y>x)
x=y;
return x;
}
int main(){
int a,b,c,m;
cout<<"请你输入三个整型的数字:"<<endl;
cin>>a>>b>>c;
m=max(a,b,c);
cout<<"The max of a b and c is:"<<m<<endl;
double ad,bd,cd,md;
cout<<"请你输入三个小数类型的数字:"<<endl;
cin>>ad>>bd>>cd;
md=max(ad,bd,cd);
cout<<"The max of a b and c is:"<<md<<endl;
long al,bl,cl,ml;
cout<<"请你输入三个长整型的数字:"<<endl;
cin>>al>>bl>>cl;
ml=max(al,bl,cl);
cout<<"The max of a b and c is:"<<ml<<endl;
return 0;
}
![](https://images2017.cnblogs.com/blog/1232720/201711/1232720-20171109214427778-2106943737.png)