题解 | #排序#sort函数(start, end)
排序
https://www.nowcoder.com/practice/508f66c6c93d4191ab25151066cb50ef
#include <iostream> #include <algorithm> using namespace std; //KY210 排序 int main() { int n; int arr[101]; while (scanf("%d", &n) != EOF) { for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } sort(arr, arr + n); for (int i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); } }