#include<iostream>
#include <vector>
#include <functional> // std::greater
#include <algorithm> // std::sort
using namespace std;
int main(void)
{
int a;
char type='a';
vector<int> vec;
cout << "请输入数字序列,最后一个数字回车结束," << endl;
while (cin >> a) {
//cout << a << endl;
vec.push_back(a);
if (cin.get() == '\n') break;
}
cout << endl;
cout << "请输入排序类别,a-升序, d-降序" << endl;
cin >> type;
cout << endl;
if (type == 'a')
{
sort(vec.begin(), vec.end()); //默认升序
}
if (type == 'd')
{
std::sort(vec.begin(), vec.end(), std::greater<int>());
}