Update Chainlist_program.c

main
pi7mcrg2k 6 days ago
parent 429dd77dd9
commit 8c7daaeeaf

@ -2,7 +2,6 @@
#include <malloc.h> #include <malloc.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <windows.h>
typedef struct Student typedef struct Student
{ {
@ -68,6 +67,7 @@ void Linklist_delete(LinkList *cur) {
cur->next->prev=cur->prev; cur->next->prev=cur->prev;
} }
cur->prev->next=cur->next; cur->prev->next=cur->next;
free(cur);
} }
void Linklist_swap(LinkList *s1, LinkList *s2){ void Linklist_swap(LinkList *s1, LinkList *s2){
@ -148,7 +148,7 @@ void find_delete(LinkList * head){
node_ptr=head; node_ptr=head;
while(node_ptr->next != NULL){ while(node_ptr->next != NULL){
node_ptr = node_ptr->next; 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) { while (node_ptr->next != NULL) {
node_ptr = node_ptr->next; node_ptr = node_ptr->next;
if(strcmp(todelatte,node_ptr->id)==0 || strcmp(todelatte,node_ptr->class)==0) { 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; find_flag = true;
} }
} }
@ -173,7 +173,7 @@ void sort_output(LinkList * head){
LinkList * node_ptr=head; LinkList * node_ptr=head;
while(node_ptr->next != NULL){ while(node_ptr->next != NULL){
node_ptr = node_ptr->next; 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; LinkList * node_ptr=head;
while(node_ptr->next != NULL){ while(node_ptr->next != NULL){
node_ptr = node_ptr->next; 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);
} }
} }

Loading…
Cancel
Save