c++中sort()函数的用法简介
代码:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int a[] = {1,4,3,3,2,2,5,7,5,6};
sort(a, a + sizeof(a) / sizeof(int));
for (auto it = a; it != a + sizeof(a) / sizeof(int); it++)
{
cout << *it << " ";
}
cout << endl;
system("pause");
return 0;
return 0;
}
运行结果: