From d7b258141f5d036e3cbab82fa4a4dbb52b8689bc Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 6 Mar 2022 04:51:50 -0500 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'1.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/1.c b/1.c index a8f7123..c7e09ed 100644 --- a/1.c +++ b/1.c @@ -253,20 +253,30 @@ void Delete(SING sing[MAX], int *num){ } *num=*num-1; } -void sort_xuhao(SING sing[MAX], int num){ +void sort_xuhao(SING sing[MAX], int num, int n){ SING temp; for(int i=0;ising[j+1].num){ - // 交换 - temp=sing[j]; - sing[j]=sing[j+1]; - sing[j+1]=temp; + if(n==1){ + if(sing[j].num>sing[j+1].num){ + // 交换 + temp=sing[j]; + sing[j]=sing[j+1]; + sing[j+1]=temp; + } + } + else{ + if(sing[j].num