C++ 代码
双指针排序,没用copy函数复制数组
#include <iostream>
using namespace std;
int main()
{
int a[3], b[3];
for (int i = 0; i < 3; i ++ )
{
cin >> a[i];
b[i] = a[i];
}
for (int i = 0; i < 2; i ++ )
for (int j = 1; j < 3; j ++ )
if (a[i] > a[j])
swap(a[i], a[j]);
for (int i = 0; i < 3; i ++ )
cout << a[i] << endl;
cout << endl;
for (int i = 0; i < 3; i ++ )
cout << b[i] << endl;
return 0;
}