作者:徐汉玉
代码:
#include <iostream>
using namespace std;
int main( )
{
int a,b,c,d,t;
cout<<"请输入四个数值:";
cin>>a>>b>>c>>d;
if(a<b)
{
t=a;
a=b;
b=t;
}
if(c<d)
{
t=c;
c=d;
d=t;
}
if(a<c)
{
t=a;
a=c;
c=t;
}
if(b<d)
{
t=b;
b=d;
d=t;
}
cout<<"max="<<a<<",min="<<d<<"\n";
return 0;
}
结果: