题目描述
读取三个整数并按升序对它们进行排序。
样例
输入样例:
7 21 -14
输出样例:
-14
7
21
7
21
-14
算法1
C++ 代码
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int x,y,z;
x=max(a,max(b,c));
y=min(a,min(b,c));
z=a+b+c-x-y;
cout<<y<<endl;
cout<<z<<endl;
cout<<x<<endl;
cout<<endl;
cout<<a<<endl;
cout<<b<<endl;
cout<<c<<endl;
return 0;
}