#include<iostream>
using namespace std;
int main()
{
const int n=10;
int smallIndex, i, j, a[n];
cout << "请输入10个整数:" << endl;
for(i=0; i<n; i++)
cin >> a[i];
for(i=0; i<n-1; i++)
{
smallIndex = i;
for(j=i+1; j<n; j++)
if(a[j] < a[smallIndex])
smallIndex = j;
int temp;
temp = a[smallIndex];
a[smallIndex] = a[i];
a[i] = temp;
}
cout << "升序排序为:" << endl;
for(i=0; i<n; i++)
cout << a[i] << " ";
cout << endl;
cout << "降序排序为:" << endl;
for(i=n-1; i>=0; i--)
cout << a[i] << " ";
return 0;
}