怎样用C++写求三个整数最大值的程序

来源:百度知道 编辑:UC知道 时间:2024/06/20 06:35:14
要完整的程序,尽量详细些,要简明易懂

#include<iostream.h>
int max(int x,int y,int z)
{
int temp;
temp=(x>=y)?x:y;
temp=(temp>=z)?temp:z;
return temp;
}
void main()
{
int a,b,c;
cout<<"input a,b,c:"<<endl;
cin>>a>>b>>c;
cout<<"the largest number among three of them is:"<<max(a,b,c)<<endl;
}

int Max (int a,int b,int c )
{
int max = a ? a > b;
return max ? max > c ;
}

int max(int a,int b,int c)
{
a>b?a=a:a=b;
a>c?a=a:a=c;
reutrn a;
}