c++编写
#include <iostream>
using namespace std;
int Max1(int a,int b){
if(a>b)
return a;
else
return b;
}
double Max1(double x,double y){
if(x>y)
return x;
else
return y;
}
int Max1(int a,int b,int c){
return Max1(a,Max1(b,c));
}
double Max1(double x,double y,double z){
return Max1(x,Max1(y,z));
}
int main(){
int a,b,c;
cout<<"please enter two integer:";
cin>>a>>b;
cout<<"there is the answer:"<<Max1(a,b)<<endl;
cout<<"please enter three integer:";
cin>>a>>b>>c;
cout<<"there is the answer:"<<Max1(a,b,c)<<endl;
double x,y,z;
cout<<"please enter two numder:";
cin>>x>>y;
cout<<"there is the answer:"<<Max1(x,y)<<endl;
cout<<"please enter three number:";
cin>>x>>y>>z;
cout<<"there is the answer:"<<Max1(x,y,z)<<endl;
return 0;
}
2013-08-02
using namespace std;
int Max1(int a,int b){
if(a>b)
return a;
else
return b;
}
double Max1(double x,double y){
if(x>y)
return x;
else
return y;
}
int Max1(int a,int b,int c){
return Max1(a,Max1(b,c));
}
double Max1(double x,double y,double z){
return Max1(x,Max1(y,z));
}
int main(){
int a,b,c;
cout<<"please enter two integer:";
cin>>a>>b;
cout<<"there is the answer:"<<Max1(a,b)<<endl;
cout<<"please enter three integer:";
cin>>a>>b>>c;
cout<<"there is the answer:"<<Max1(a,b,c)<<endl;
double x,y,z;
cout<<"please enter two numder:";
cin>>x>>y;
cout<<"there is the answer:"<<Max1(x,y)<<endl;
cout<<"please enter three number:";
cin>>x>>y>>z;
cout<<"there is the answer:"<<Max1(x,y,z)<<endl;
return 0;
}
2013-08-02
2013-08-02