Created
February 3, 2016 04:25
-
-
Save ityuhui/c7dc7f914b78cf750e88 to your computer and use it in GitHub Desktop.
C++ STL Vector 排序
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
int main() | |
{ | |
int initv[] = {4,2,78,12,3,2,77,34}; | |
std::vector<int> a(initv,initv+sizeof(initv)/sizeof(int)); | |
sort(a.begin(), a.end()); | |
for (auto it = a.begin(); it != a.end(); ++it) { | |
std::cout << *it << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment