Sort the given sequence in non-decreasing order.
Input
One line contains a sequence of no more than 105 integers.
Output
Print in one line a sequence of numbers in non-decreasing order.
按非递减顺序对给定序列进行排序。
输入
每行包含不超过105个整数的序列。
输出
在一行中打印非递减顺序的数字序列。
Sample
Input Output
4 1 4 8 6 6 5 1 4 4 5 6 6 8
利用内置sort()函数排序 C++函数
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
快乐鹦鹉 2023-03-10 18:30关注有啥问题啊,sort(a,a+n)这样子啊
#include <iostream> using namespace std; #include<algorithm> int main() { int a[105]; for(int i=0;i<105;i++) cin>>a[i]; sort(a,a+105); for(int i=0;i<105;i++) cout<<a[i]<<" "; }解决 无用评论 打赏 举报 编辑记录