C语言的如下:
#include <stdio.h>
void main()
{
int max(int x,int y,int z);
int a,b,c,e;
printf("请输入三个整数!\n");
scanf("%d %d %d",&a,&b,&c);
e=max(a,b,c);
printf("max=%d\n",e);
}
int max(int x,int y,int z)
{
int t=x>y?x:y;
t=t>z?t:z;
return (t);
}
C++的如下:
#include <iostream>
using namespace std;
int max(int x,int y,int z)
{
int t=x>y?x:y;
t=t>z?t:z;
return t;
}
int main()
{
int x,y,z;
cout<<"请输入三个整数!"<<endl;
cin>>x>>y>>z;
cout<<x<<","<<y<<","<<z<<"的最大值为"<<max(x,y,z)<<endl;
system("PAUSE");
return 0;
}
补充:xyz换成abc 求最小同理
温馨提示:答案为网友推荐,仅供参考