删除 排序/maopaopaixu.cpp
准备 重新 上传
This commit is contained in:
@@ -1,36 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<iomanip>
|
|
||||||
using namespace std;
|
|
||||||
int main(){
|
|
||||||
|
|
||||||
int n=5,max;
|
|
||||||
bool bl=false;
|
|
||||||
int a[n]={12,22,81,94,95};
|
|
||||||
|
|
||||||
for(int i=0;i<n;i++){
|
|
||||||
|
|
||||||
for(int j=0;j<n-i-1;j++){
|
|
||||||
|
|
||||||
if(a[j]>a[j+1]){
|
|
||||||
|
|
||||||
max=a[j];
|
|
||||||
a[j]= a[j+1];
|
|
||||||
a[j+1]=max;
|
|
||||||
|
|
||||||
bl=true;
|
|
||||||
}
|
|
||||||
if (!bl)
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
for(int j=0;j<n;j++)
|
|
||||||
cout<<a[j]<<" ";
|
|
||||||
cout<<endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user