测试int的sort功能
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std
;
void PrintVec(const vector
<int>& vec_
)
{
auto i_
= vec_
.begin();
while(i_
!= vec_
.end())
{
cout
<< * i_
<< endl
;
++i_
;
}
}
void SortTest(vector
<int>& vec_
)
{
sort(vec_
.begin(),vec_
.end());
return;
}
int main() {
vector
<int> vec_
= {1,2,6,3,10,2,4,8};
SortTest(vec_
);
PrintVec(vec_
);
std
::cout
<< "Hello, World!" << std
::endl
;
return 0;
}
输入结果:
Giser_D
认证博客专家
C/C++
https://github.com/huifeng-kooboo编程爱好者,喜欢学习客户端技术和网站后端技术、对爬虫技术颇有研究
转载请注明原文地址:https://ipadbbs.8miu.com/read-63382.html