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.exe.recipe b/Project2/Debug/Project2.exe.recipe index 5058dca..8ecf20e 100644 --- a/Project2/Debug/Project2.exe.recipe +++ b/Project2/Debug/Project2.exe.recipe @@ -2,7 +2,7 @@ - C:\code\lencode\Project2\Debug\Project2.exe + C:\Users\段宇宸\Documents\GitHub\Project2\Debug\Project2.exe diff --git a/Project2/Debug/Project2.log b/Project2/Debug/Project2.log index 976bffc..ce41d52 100644 --- a/Project2/Debug/Project2.log +++ b/Project2/Debug/Project2.log @@ -1,2 +1 @@ - sq_list.c - Project2.vcxproj -> C:\code\lencode\Project2\Debug\Project2.exe + Project2.vcxproj -> C:\Users\段宇宸\Documents\GitHub\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..53c914f 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 161a884..c2df495 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 cd2bbd5..11f3298 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/Cl.items.tlog b/Project2/Debug/Project2.tlog/Cl.items.tlog index f9da5c0..900f0d6 100644 --- a/Project2/Debug/Project2.tlog/Cl.items.tlog +++ b/Project2/Debug/Project2.tlog/Cl.items.tlog @@ -1,4 +1,4 @@ -C:\code\lencode\Project2\linked_list.c;C:\code\lencode\Project2\Project2\Debug\linked_list.obj -C:\code\lencode\Project2\linked_list_stack.c;C:\code\lencode\Project2\Project2\Debug\linked_list_stack.obj -C:\code\lencode\Project2\main.c;C:\code\lencode\Project2\Project2\Debug\main.obj -C:\code\lencode\Project2\sq_list.c;C:\code\lencode\Project2\Project2\Debug\sq_list.obj +C:\Users\段宇宸\Documents\GitHub\Project2\linked_list.c;C:\Users\段宇宸\Documents\GitHub\Project2\Project2\Debug\linked_list.obj +C:\Users\段宇宸\Documents\GitHub\Project2\linked_list_stack.c;C:\Users\段宇宸\Documents\GitHub\Project2\Project2\Debug\linked_list_stack.obj +C:\Users\段宇宸\Documents\GitHub\Project2\main.c;C:\Users\段宇宸\Documents\GitHub\Project2\Project2\Debug\main.obj +C:\Users\段宇宸\Documents\GitHub\Project2\sq_list.c;C:\Users\段宇宸\Documents\GitHub\Project2\Project2\Debug\sq_list.obj diff --git a/Project2/Debug/Project2.tlog/Project2.lastbuildstate b/Project2/Debug/Project2.tlog/Project2.lastbuildstate index 9743022..c601493 100644 --- a/Project2/Debug/Project2.tlog/Project2.lastbuildstate +++ b/Project2/Debug/Project2.tlog/Project2.lastbuildstate @@ -1,2 +1,2 @@ -PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.43.34808:TargetPlatformVersion=10.0.26100.0: -Debug|Win32|C:\code\lencode\Project2\| +PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.43.34808:TargetPlatformVersion=10.0.22621.0: +Debug|Win32|C:\Users\段宇宸\Documents\GitHub\Project2\| 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/Project2.tlog/link.read.1.tlog b/Project2/Debug/Project2.tlog/link.read.1.tlog index 4b35156..a41af58 100644 Binary files a/Project2/Debug/Project2.tlog/link.read.1.tlog and b/Project2/Debug/Project2.tlog/link.read.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/link.secondary.1.tlog b/Project2/Debug/Project2.tlog/link.secondary.1.tlog index 578ed71..a91ecb3 100644 --- a/Project2/Debug/Project2.tlog/link.secondary.1.tlog +++ b/Project2/Debug/Project2.tlog/link.secondary.1.tlog @@ -1,2 +1,2 @@ -^C:\CODE\LENCODE\PROJECT2\PROJECT2\DEBUG\LINKED_LIST.OBJ|C:\CODE\LENCODE\PROJECT2\PROJECT2\DEBUG\LINKED_LIST_STACK.OBJ|C:\CODE\LENCODE\PROJECT2\PROJECT2\DEBUG\MAIN.OBJ|C:\CODE\LENCODE\PROJECT2\PROJECT2\DEBUG\SQ_LIST.OBJ -C:\code\lencode\Project2\Project2\Debug\Project2.ilk +^C:\USERS\段宇宸\DOCUMENTS\GITHUB\PROJECT2\PROJECT2\DEBUG\LINKED_LIST.OBJ|C:\USERS\段宇宸\DOCUMENTS\GITHUB\PROJECT2\PROJECT2\DEBUG\LINKED_LIST_STACK.OBJ|C:\USERS\段宇宸\DOCUMENTS\GITHUB\PROJECT2\PROJECT2\DEBUG\MAIN.OBJ|C:\USERS\段宇宸\DOCUMENTS\GITHUB\PROJECT2\PROJECT2\DEBUG\SQ_LIST.OBJ +C:\Users\段宇宸\Documents\GitHub\Project2\Project2\Debug\Project2.ilk diff --git a/Project2/Debug/Project2.tlog/link.write.1.tlog b/Project2/Debug/Project2.tlog/link.write.1.tlog index 67bcf27..4a65130 100644 Binary files a/Project2/Debug/Project2.tlog/link.write.1.tlog and b/Project2/Debug/Project2.tlog/link.write.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/main.c b/main.c index ae7d234..ebfdb48 100644 --- a/main.c +++ b/main.c @@ -10,10 +10,10 @@ int main(void) sq_list* L = init_sq_list(); sq_list* N = init_sq_list(); - for (int i = 1; i <= 3; i++) - { - N->data[i - 1] = i; - } + N->data[0] = 11; + N->data[1] = 12; + N->data[2] = 13; + for (int i = 1; i <= 10; i++) { L->data[i - 1] = i; @@ -23,7 +23,7 @@ int main(void) print_sq_list(N); print_sq_list(L); printf("----------------------------------"); - merge_sq_list(N,L); + mer_ge_sq_list(L,N); print_sq_list(L); printf("%d", L->length); printf("Hello World!\n"); diff --git a/sq_list.c b/sq_list.c index 658c42f..275078a 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--; + } // 滻 @@ -77,6 +78,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) { @@ -113,4 +151,25 @@ 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