显示优化

This commit is contained in:
Jdhggg 2025-03-20 23:34:22 +08:00
parent 285c764123
commit 7935f0fbe0
6 changed files with 7 additions and 3 deletions

View File

@ -1,2 +1,2 @@
 sq_list.c  main.c
Project2.vcxproj -> C:\code\lencode\Project2\Debug\Project2.exe Project2.vcxproj -> C:\code\lencode\Project2\Debug\Project2.exe

4
main.c
View File

@ -22,10 +22,10 @@ int main(void)
L->length = 10; L->length = 10;
print_sq_list(N); print_sq_list(N);
print_sq_list(L); print_sq_list(L);
printf("----------------------------------");
merge_sq_list(N,L); merge_sq_list(N,L);
print_sq_list(L); print_sq_list(L);
printf("%d", L->length); printf("L->length:[%d]\n", L->length);
printf("Hello World!\n"); printf("Hello World!\n");
system("pause");
return 0; return 0;
} }

View File

@ -72,8 +72,10 @@ void insert_sq_list(sq_list* list, int pos, int value)
// 打印 // 打印
void print_sq_list(sq_list* list) void print_sq_list(sq_list* list)
{ {
printf("[");
for (int i = 0; i < list->length; i++) for (int i = 0; i < list->length; i++)
printf("%d ", list->data[i]); printf("%d ", list->data[i]);
printf("]");
printf("\n"); printf("\n");
} }
@ -107,7 +109,9 @@ void merge_sq_list(sq_list* list_1, sq_list* list_2)
} }
} }
printf("----------------------------------\n");
printf("有%d相同 有%d不相同\n", flog, list_2->length - flog); printf("有%d相同 有%d不相同\n", flog, list_2->length - flog);
printf("----------------------------------\n");
} }
//if (list_1->data[j] != list_2->data[i]) //if (list_1->data[j] != list_2->data[i])