diff --git a/Project2/Debug/Project2.log b/Project2/Debug/Project2.log index 259d036..864d6f9 100644 --- a/Project2/Debug/Project2.log +++ b/Project2/Debug/Project2.log @@ -1,2 +1,4 @@  main.c + sq_list.c + 正在生成代码... Project2.vcxproj -> C:\code\lencode\Project2\Debug\Project2.exe diff --git a/Project2/Debug/Project2.tlog/CL.command.1.tlog b/Project2/Debug/Project2.tlog/CL.command.1.tlog index 5c9a976..63d0292 100644 Binary files a/Project2/Debug/Project2.tlog/CL.command.1.tlog and b/Project2/Debug/Project2.tlog/CL.command.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/CL.read.1.tlog b/Project2/Debug/Project2.tlog/CL.read.1.tlog index 0ee1b32..48850f0 100644 Binary files a/Project2/Debug/Project2.tlog/CL.read.1.tlog and b/Project2/Debug/Project2.tlog/CL.read.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/CL.write.1.tlog b/Project2/Debug/Project2.tlog/CL.write.1.tlog index 5e17f11..f8a0555 100644 Binary files a/Project2/Debug/Project2.tlog/CL.write.1.tlog and b/Project2/Debug/Project2.tlog/CL.write.1.tlog differ diff --git a/sq_list.c b/sq_list.c index a4ac840..3d69003 100644 --- a/sq_list.c +++ b/sq_list.c @@ -62,7 +62,7 @@ void insert_sq_list(sq_list* list, int pos, int value) list->data[i + 1] = list->data[i]; } list->data[pos] = value; - if (flog + 1 > list->length) + /* if (flog + 1 > list->length)*/ list->length++; } @@ -93,24 +93,24 @@ void merge_sq_list(sq_list* list_1, sq_list* list_2) for (int i = 0; i < list_2->length; i++) { - for (int j = 0; j < list_1->length; j++) + for (int j = 0; j < list_1->length; j++) { if (list_1->data[j] != list_2->data[i]) - continue; - else if (list_1->data[j] == list_2->data[i]) { - flog++; break; - } - else - { - list_1->data[list_1->length] = list_2->data[i]; - list_1->length++; + if (j == list_1->length -1) + { + list_1->data[list_1->length] = list_2->data[i]; + list_1->length++; + flog++; + } + else + continue; } } } printf("----------------------------------\n"); - printf("%dͬ %dͬ\n", flog, list_2->length - flog); + printf("%dͬ %dͬ\n", flog, list_2->length - flog); printf("----------------------------------\n"); }