/*编写重载函数可分别求取
两个整数,三个整數,两个双精度数,三个双精度数的最大值。
并在主函数中分别测试。*/
#include <iostream>
using namespace std;
int Max1(int,int);
int Max1(int,int,int);
double Max1(double,double);
double Max1(double,double,double);
//此处添加用户自定义的函数代码
int main()
{
int x1,x2;
cin>>x1>>x2;
cout<<Max1(x1,x2);
int x3,x4,x5;
cin>>x3>>x4>>x5;
cout<<Max1(x3,x4,x5);
double x6,x7;
cin>>x6>>x7;
cout<<Max1(x6,x7);
double x8,x9,x0;
cin>>x8>>x9>>x0;
cout<<Max1(x8,x9,x0);
//此处添加代码
return 0;
}
int Max1(int a,int b)
{
return a>b?a:b;
}
int Max1(int a,int b,int c)
{
int Max1=a>b?a:b;
return Max1>c?Max1:c;
}
double Max1(double a,double b)
{
return a>b?a:b;
}
double Max1(double a,double b,double c)
{
double Max1=a>b?a:b;
return Max1>c?Max1:c;
}
输入 1 2 3 1.1 2.2 3.3
理想输出 2 3 2.2 3.3