From fd6a8c165b08ef933ce5b8c480c72593bfd4cee2 Mon Sep 17 00:00:00 2001 From: haoxuan Date: Sat, 7 Feb 2026 02:52:54 -0500 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8C=E6=8E=92=E5=BA=8F=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 已优化过有序运行方式 --- 排序/maopaopaixu.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 排序/maopaopaixu.cpp diff --git a/排序/maopaopaixu.cpp b/排序/maopaopaixu.cpp new file mode 100644 index 0000000..ca52c2f --- /dev/null +++ b/排序/maopaopaixu.cpp @@ -0,0 +1,36 @@ +#include +#include +using namespace std; +int main(){ + + int n=5,max; + bool bl=false; + int a[n]={12,22,81,94,95}; + + for(int i=0;ia[j+1]){ + + max=a[j]; + a[j]= a[j+1]; + a[j+1]=max; + + bl=true; + } + if (!bl) + break; + + } + + + } + for(int j=0;j