You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python/TangDou/KaoShi/由大到小排序带逗号.cpp

16 lines
316 B

#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int a[N];
/*
3 2 5 5 4
*/
int main() {
int n = 5;
for (int i = 1; i <= n; i++) cin >> a[i];
sort(a + 1, a + 1 + n, greater<int>());
for (int i = 1; i < n; i++) printf("%d,", a[i]);
printf("%d", a[n]);
return 0;
}