可以对cmp函数进行重写然后调用sort就行了,代码如下
bool cmp(long long a, long long b)
{
	if (a % 10 != b % 10)
		return a % 10 < b % 10;
	return a < b;
}

void Sort_out(vector<long long>& val)
{
	sort(val.begin(), val.end(), cmp);
	vector<long long>::iterator it = val.begin();
	while (it != val.end())
	{
		cout << *it << endl;
		it++;
	}
}