//3个变量从小到大排序 函数参数引用传递完成
#include <iostream>
using namespace std;
//函数参数引用传递完成
void sort1(int& a1, int& b1, int& c1)
{
int temp;
//3个if判断 思想和冒泡排序一样
if (a1 > b1)
{
temp = a1;
a1 = b1;
b1 = temp;
}
if (b1 > c1)
{
temp = b1;
b1 = c1;
c1 = temp;
}
if (a1 > b1)
{
temp = a1;
a1 = b1;
b1 = temp;
}
cout << a1 <<" "<< b1 << " "<< c1 << endl;
}
int main()
{
int a, b, c;
cout << "请输入三个数字:" << endl;
cin >> a >> b >> c;
sort1(a,b,c);
return 0;
}