/*Description
编写函数max,函数声明如下:
int max(int x,int y,int z); //求三个参数中的最大值的函数声明
在以下程序的基础上,添加max函数的定义,使程序能够正确执行。
提交时,只需要提交max函数的定义代码即可。
#include <iostream>
using namespace std;
int max(int x,int y,int z); //求三个参数中的最大值的函数声明
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<"max=";
cout<<max(a,b,c);
return 0;
}
Input
三个整数
Output
这三个整数中的最大值
Sample Input
3 6 4
Sample Output
max=6
HINT
*/
#include <iostream>
using namespace std;
int max(int x,int y,int z); //求三个参数中的最大值的函数声明
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<"max=";
cout<<max(a,b,c);
return 0;
}
int max(int x,int y,int z)
{
if(x>y)
y=x;
if(y>z)
y=z;
return z;
}
C++ 计166-1 函数---求三个数中的最大值
最新推荐文章于 2024-02-05 22:00:03 发布