<span style="font-size:18px;">#include <iostream>
using namespace std;
int main()
{
int sort(int &x,int &y,int &z);
int a,b,c;
cout<<"Please input three numbers:"<<endl;
cin>>a>>b>>c;
sort(a,b,c);
cout<<a<<','<<b<<','<<c<<endl;
return 0;
}
void sort(int &x,int &y,int &z)
{
int temp;
if(x>y)
{
temp=x;
x=y;
y=temp;
}
if(z<x) cout<<z<<','<<x<<','<<y<<endl;
else if(z<y) cout<<x<<','<<z<<','<<y<<endl;
else cout<<x<<','<<y<<','<<z<<endl;
}
</span>
第六题 P035
最新推荐文章于 2021-05-18 14:32:58 发布