更新 'ex8_1.c'

This commit is contained in:
xtaodada 2022-06-10 00:55:54 +00:00
parent a4ec368095
commit 0a03411446

View File

@ -4,7 +4,7 @@
#define MAX 100 #define MAX 100
typedef int DataType; typedef int DataType;
typedef struct list{ typedef struct list{
int data[MAX]; DataType data[MAX];
int start; int start;
int length; int length;
}List; }List;
@ -13,7 +13,7 @@ typedef struct list{
*/ */
void DirectSort(List *L){ void DirectSort(List *L){
int j; int j;
for(int i = 2; i<=L->length; i++){ for(int i = 2; i <= L->length; i++){
L->data[0] = L->data[i]; L->data[0] = L->data[i];
j = i-1; j = i-1;
while(L->data[0] < L->data[j]){ while(L->data[0] < L->data[j]){
@ -105,4 +105,3 @@ int main(){
printf("感谢使用,再见\n"); printf("感谢使用,再见\n");
return 0; return 0;
} }