From 8c7daaeeaf6dda3793593268c3fe805b9e469277 Mon Sep 17 00:00:00 2001 From: pi7mcrg2k <1653133624@qq.com> Date: Sun, 17 Nov 2024 12:52:06 +0800 Subject: [PATCH] Update Chainlist_program.c --- Chainlist_program.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Chainlist_program.c b/Chainlist_program.c index b668814..3de6518 100644 --- a/Chainlist_program.c +++ b/Chainlist_program.c @@ -2,7 +2,6 @@ #include #include #include -#include typedef struct Student { @@ -68,6 +67,7 @@ void Linklist_delete(LinkList *cur) { cur->next->prev=cur->prev; } cur->prev->next=cur->next; + free(cur); } void Linklist_swap(LinkList *s1, LinkList *s2){ @@ -148,7 +148,7 @@ void find_delete(LinkList * head){ node_ptr=head; while(node_ptr->next != NULL){ node_ptr = node_ptr->next; - printf("%s,%s,%s,%lf,%lf,%lf,%lf\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); + printf("%s,%s,%s,%.1f,%.1f,%.1f,%.1f\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); } } @@ -161,7 +161,7 @@ void find(LinkList * head){ while (node_ptr->next != NULL) { node_ptr = node_ptr->next; if(strcmp(todelatte,node_ptr->id)==0 || strcmp(todelatte,node_ptr->class)==0) { - printf("%s,%s,%s,%lf,%lf,%lf,%lf\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); + printf("%s,%s,%s,%.1f,%.1f,%.1f,%.1f\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); find_flag = true; } } @@ -173,7 +173,7 @@ void sort_output(LinkList * head){ LinkList * node_ptr=head; while(node_ptr->next != NULL){ node_ptr = node_ptr->next; - printf("%s,%s,%s,%lf,%lf,%lf,%lf\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); + printf("%s,%s,%s,%.1f,%.1f,%.1f,%.1f\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); } } @@ -182,7 +182,7 @@ void output(LinkList * head){ LinkList * node_ptr=head; while(node_ptr->next != NULL){ node_ptr = node_ptr->next; - printf("%s,%s,%s,%lf,%lf,%lf,%lf\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); + printf("%s,%s,%s,%.1f,%.1f,%.1f,%.1f\n",node_ptr->id,node_ptr->class,node_ptr->name,node_ptr->score1,node_ptr->score2,node_ptr->score3,node_ptr->score); } }