diff --git a/Project2.vcxproj.filters b/Project2.vcxproj.filters index b947b58..4622cd9 100644 --- a/Project2.vcxproj.filters +++ b/Project2.vcxproj.filters @@ -18,15 +18,15 @@ 源文件 - - 源文件 - 源文件 源文件 + + 源文件 + diff --git a/Project2/Debug/Project2.log b/Project2/Debug/Project2.log index 864d6f9..e69de29 100644 --- a/Project2/Debug/Project2.log +++ b/Project2/Debug/Project2.log @@ -1,4 +0,0 @@ - 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 63d0292..3dcb4bf 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 48850f0..e69de29 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 f8a0555..e69de29 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/Project2/Debug/Project2.tlog/link.command.1.tlog b/Project2/Debug/Project2.tlog/link.command.1.tlog index 71d5a57..21a31c1 100644 Binary files a/Project2/Debug/Project2.tlog/link.command.1.tlog and b/Project2/Debug/Project2.tlog/link.command.1.tlog differ diff --git a/Project2/Debug/main.obj.enc b/Project2/Debug/main.obj.enc new file mode 100644 index 0000000..c7bca44 Binary files /dev/null and b/Project2/Debug/main.obj.enc differ diff --git a/Project2/Debug/sq_list.obj.enc b/Project2/Debug/sq_list.obj.enc new file mode 100644 index 0000000..a3369ec Binary files /dev/null and b/Project2/Debug/sq_list.obj.enc differ diff --git a/sq_list.c b/sq_list.c index 3d69003..9ff8dfc 100644 --- a/sq_list.c +++ b/sq_list.c @@ -27,6 +27,7 @@ void delete_sq_list(sq_list* list,int pos) list->data[list->length - 1] = 0; } list->length--; + } // 滻 @@ -79,6 +80,43 @@ void print_sq_list(sq_list* list) printf("\n"); } +//Ԫ +void get_sq_list(sq_list* list1, int pos, int*e) +{ + if (list1->length == 0 || pos<0 || pos>list1->length) + { + printf("ȡԪʧ"); + return; + } + *e = list1->data[pos]; + return; +} + +// +int locate_list(sq_list* list, int *e) +{ + int i = 0; + if (list->length == 0) + { + printf("Ϊ"); + return; + } + for (i = 0;i < list->length;i++) + { + if (list->data[i] == e) + return 1; + } + if (i > list->length) + { + printf("Խ"); + return; + } + return 0; + +} + + + // 2 1 void merge_sq_list(sq_list* list_1, sq_list* list_2) { @@ -117,4 +155,18 @@ void merge_sq_list(sq_list* list_1, sq_list* list_2) //if (list_1->data[j] != list_2->data[i]) //continue; //else if (list_1->data[j] == list_2->data[i]) -//break; \ No newline at end of file +//break; + +//ϲ2.0 +void mer_ge_sq_list(sq_list* list_1, sq_list* list_2) +{ + int e; + int k = 0; + for (int k=0;k < list_2->length;k++) + { + get_sq_list(list_2, k, &e); + if (!locate_list(list_1, list_2)) + insert_sq_list(list_1, list_1->length, e); + } +} + diff --git a/sq_list.h b/sq_list.h index 25c0939..7dd531a 100644 --- a/sq_list.h +++ b/sq_list.h @@ -24,8 +24,16 @@ void insert_sq_list(sq_list* list, int pos, int value); // ӡ void print_sq_list(sq_list* list); -// ϲ˳ +//Ԫ +void get_sq_list(sq_list* list1,int pos, int *e); + +// +int locate_list(sq_list* list, int e); + +// ϲ˳1.0 void merge_sq_list(sq_list* list_1, sq_list* list_2); +//ϲ˳2.0 +void mer_ge_sq_list(sq_list* list_1, sq_list* list_2); #endif