'commit'
This commit is contained in:
16
TangDou/KaoShi/由大到小排序带逗号.cpp
Normal file
16
TangDou/KaoShi/由大到小排序带逗号.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user