1个回答
展开全部
#include<iostream.h>
int max(int a,int b,int c)
{ int temp;
temp=a;
if(temp>b&&temp>c)
return a;
else if(b>temp&&b>c)
return b;
else if(c>b&&c>temp)
return c;}
double max(float a,float b,float c)
{ float temp;
temp=a;
if(temp>b&&temp>c)
return a;
else if(b>temp&&b>c)
return b;
else if(c>b&&c>temp)
return c;}
int main()
{ int m,n,l;
cout<<"请输入:"<<endl;
cin>>n>>m>>l;
cout<<"比较后"<<endl;
cout<<max(m,n,l)<<endl;
float t,e,f;
cout<<"请输入:"<<endl;
cin>>t>>e>>f;
cout<<"比较后"<<endl;
cout<<max(t,e,f)<<endl;
}
int max(int a,int b,int c)
{ int temp;
temp=a;
if(temp>b&&temp>c)
return a;
else if(b>temp&&b>c)
return b;
else if(c>b&&c>temp)
return c;}
double max(float a,float b,float c)
{ float temp;
temp=a;
if(temp>b&&temp>c)
return a;
else if(b>temp&&b>c)
return b;
else if(c>b&&c>temp)
return c;}
int main()
{ int m,n,l;
cout<<"请输入:"<<endl;
cin>>n>>m>>l;
cout<<"比较后"<<endl;
cout<<max(m,n,l)<<endl;
float t,e,f;
cout<<"请输入:"<<endl;
cin>>t>>e>>f;
cout<<"比较后"<<endl;
cout<<max(t,e,f)<<endl;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询