#include <iostream> using namespace std; int main(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ for(int j=1;j<=n-i;j++){ if(a[j-1]<a[j]){ int t=a[j-1]; a[j-1]=a[j]; a[j]=t; } } } for(int i=0;i<n;i++){ cout<<a[i]<<endl; } return 0; }
标签:std,int,namespace,cin,冒泡排序,main From: https://www.cnblogs.com/fushuxuan/p/17633716.html