首页 > 其他 > 详细

sort用法

时间:2014-02-28 16:58:39      阅读:440      评论:0      收藏:0      [点我收藏+]

sort用于C++中,将数字从小到大排列。

bubuko.com,布布扣
 1 /*
 2     Name: sort用法 
 3     Copyright: Analyst
 4     Author: Analyst
 5     Date: 27/02/14 22:52
 6     Description: dev-cpp 5.5.3
 7 */
 8 #include <iostream>
 9 #include <algorithm>   //sort头文件 
10 using namespace std;
11 int main()
12 {
13     int array[10] = {4,2,0,6,8,1,3,5,9,7};   
14     
15     sort(array,array+10);   //排序 
16     for (int i = 0; i < 10; ++i)
17         printf("%d ",array[i]);
18         
19     return 0;
20 }
bubuko.com,布布扣

运行结果:

0 1 2 3 4 5 6 7 8 9
--------------------------------
Process exited with return value 0
Press any key to continue . . .

sort用法,布布扣,bubuko.com

sort用法

原文:http://www.cnblogs.com/jopus/p/3572601.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!