用C++编写输入四个数输出最大最小值的程序
源代码如下:
#include <iostream>
using namespace std;
int main()
{int a,b,c,d;
cout<<"please input 4 munber:";
cin>>a>>b>>c>>d;
if(a>=b)
if(c>=d)
if(a>=c)
if(b>=d)
cout<<"max:"<<a<<'\n'<<"min:"<<d<<'\n';
else
cout<<"max:"<<a<<'\n'<<"min:"<<b<<'\n';
else
if(b>=d)
cout<<"max:"<<c<<'\n'<<"min:"<<d<<'\n';
else
cout<<"max:"<<c<<'\n'<<"min:"<<b<<'\n';
else
if(a>=d)
if(b>=c)
cout<<"max:"<<a<<'\n'<<"min:"<<c<<'\n';
else
cout<<"max:"<<a<<'\n'<<"min:"<<b<<'\n';
else
源代码大电影 if(c>=d)
if(b>=c)
if(a>=d)
cout<<"max:"<<b<<'\n'<<"min:"<<d<<'\n';
else
cout<<"max:"<<b<<'\n'<<"min:"<<a<<'\n';
else
if(a>=d)
cout<<"max:"<<c<<'\n'<<"min:"<<d<<'\n';
else
cout<<"max:"<<c<<'\n'<<"min:"<<a<<'\n';
else
if(b>=d)
if(a>=c)
cout<<"max:"<<b<<'\n'<<"min:"<<c<<'\n';
else
cout<<"max:"<<b<<'\n'<<"min:"<<a<<'\n';
return 0;
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论