一、先引用万能头文件才能使用C++的sort库函数
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
int a[5] = { 1,3,2,8,5 };
sort(a, a + 5); //默认是升序 第一个参数为要排序数组的开始地址,第二个是你希望排序数组的结束地址
for (int i = 0; i < 5; i++)
cout << a[i]<<" ";
return 1;
}