#include <iostream>
using namespace std;
int a[11];
int main(){
for(int i=1;i<=10;i++){
cin >> a[i];
}
int temp;
for(int i=1;i<10;i++){
for(int j=1;j<=10-i;j++){
if(a[j]<a[j+1]){
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
for(int i=1;i<=10;i++){
cout << " " << a[i];
}
}
5.6 输入是个正整数,然后自动从大到小顺序输出(冒泡排序)
分类:数组
时间:2026-01-02 21:47:25
评论留言 (0条)