Sorting vector using std::sort - C++ - Source...
来源:百度文库 编辑:神马文学网 时间:2024/03/29 18:09:06
C++ Vector Sort
Join 409,116 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,486 people online right now.Registration is fast and FREE... Join Now!
Chat LIVE With a C++ Expert
Rating: Views: 32,853
Join 409,116 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,486 people online right now.Registration is fast and FREE... Join Now!
Chat LIVE With a C++ Expert
Sorting vector using std::sort
Submitted By: Xing Actions:Rating: Views: 32,853
Language: C++
Last Modified: December 9, 2006Snippet
- #include
- #include
- #include
- using namespace std;
- int main() {
- int val, count = 0;
- vector
vec; - cout << "Enter integers,
after each, Z to finish:" << endl; - //Validating input and saving in vector container
- while( cin >> val, cin.good() ) {
- vec.push_back( val );
- ++count;
- }
- if ( count ) {
- //Sorting vector
- sort( vec.begin(), vec.end() );
- //Displaying data
- cout<<"Sorted Vector: ";
- for (vector
::const_iterator it=vec.begin(); it!=vec.end(); ++it) - cout << *it << " ";
- cout << endl;
- }
- return 0;
- }
- #include
Copy & Paste
Comments
There are currently no comments for this snippet. Be the first to comment!
Sorting vector using std::sort - C++ - Source...
using namespace std
using namespace std
using namespace std详解
C++ using namespace std 详解
A Beginner's Tutorial For std::vector, Part 1
C#Using用法
sort
vector
Debugging ""C"" And ""C++"" Programs Using ""gdb""
项目管理实践教程二、源代码控制【Source Control Using VisualSV...
Smartwin - An Open Source C GUI and SOAP ...
Building And Using Static And Shared ""C"" Libraries
Shopping Cart using C#.NET, Web Forms and SQL...
MySQL :: Developing Database Applications Using MySQL Connector/C
sort排序
sorting algorithm - encyclopedia article about sorting algorithm.
sorting algorithm - encyclopedia article about sorting algorithm.
vector类
JavaScript数组sort方法
LINUX SORT 命令
AJAX source
Java Vector的用法
函数返回vector