From 66609959d0c0a2d283f51628f05ea242ff1708bc Mon Sep 17 00:00:00 2001 From: pexufr8to <1298707507@qq.com> Date: Sat, 19 Feb 2022 21:00:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 排序 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 排序 diff --git a/排序 b/排序 new file mode 100644 index 0000000..ea3d52d --- /dev/null +++ b/排序 @@ -0,0 +1,22 @@ +//冒泡排序法 +#include +int main() +{ + int i,j,t,a[n]; + +for(i=1;ia[j+1]) + { + t=a[j]; + a[j]=a[j+1]; + a[j+1]=t; + } + printf("排序后的顺序是:\n"); + for(i=1;i<=n-1;i++) + printf("%d ",a[i]); + printf("\n"); +return 0; +} \ No newline at end of file