<pre class="cpp" name="code"><img src="https://img-blog.csdn.net/20150407195046257" alt="" />#include<iostream>
using namespace std;
void swap(int &x,int &y,int &z)
{
int temb;
if(y<x)
{
temb=x;
x=y;
y=temb;
}
if(z<y)
{
temb=z;
z=y;
y=temb;
}
if(y<x)
{
temb=y;
y=x;
x=temb;
}
}
int main()
{
int a,b,c;
cin>>a>>b>>c;
swap(a,b,c);
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
1.9
最新推荐文章于 2024-10-17 13:41:48 发布