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