PAT serie b 1004 has been showing error...
CodePudding user response:
Later don't again hair screenshots, post code, directly show you post is not a compiler, it can be run out; Unless it is carefree get boring no one will put your code to play again
CodePudding user response:
Send you:
CSDN BBS newbie guide CodePudding user response:
reference 1st floor qq_45798109 response: later don't again hair screenshots, code, directly show you post is not a compiler, it can be run out; Unless it is carefree get boring no one will take your code to play again thank you predecessors CodePudding user response:
refer to the second floor wowpH response: send you: CSDN BBS newbie guide thank you, now put the code CodePudding user response:
#include #include # define len sizeof (struct student) Struct student * creat (void); Struct student { Char name [11]. Char sno [11]. Int score; Struct student * next; }; Int main (void) { Struct student * p, * (p1, p2, p3, p4, * p5; Int the Max and min. P=p3 p4==creat (); //it is only a classmate P5=p4; P4=p4 - & gt; Next; If (p4 - & gt; Name==NULL) { Printf (" % s % s \ n ", p5 - & gt; The name, p5 - & gt; Sno); Printf (" % s % s \ n ", p5 - & gt; The name, p5 - & gt; Sno); } //Max find P1=p; Max=p - & gt; Score; P=p - & gt; Next; Do { If (max<(p - & gt; Score)) { Max=p - & gt; Score; P1=p; } P=p - & gt; Next; } while (p - & gt; next!=NULL); //the minimum for The p2=p3; Min=p3 - & gt; Score; P3=p3 - & gt; Next; Do { If (min> (p3 - & gt; Score)) { Min=p3 - & gt; Score; The p2=p3; } P3=p3 - & gt; Next; } while (p3 - & gt; next!=NULL); Printf (" % s % s \ n ", p1 - & gt; The name, p1 - & gt; Sno); Printf (" % s % s \ n ", p2 - & gt; The name, p2 - & gt; Sno); } Struct student * creat (void) { Int n, I; Struct student * head; P1 struct student * * (p2); The scanf (" % d ", & amp; N); The p2=(struct student *) malloc (len); P1=(struct student *) malloc (len); for(i=0; i The scanf (" % d % s % s ", p1 - & gt; The name, p1 - & gt; Sno, & amp; P1 - & gt; Score); If (I==0) { The head=p1; } The else { The p2 - & gt; Next=p; } P1 p2=; If (I.=n - 1) { P1=(struct student *) malloc (len); } } The p2 - & gt; Next=NULL; Return (the head); } CodePudding user response:
# include #include # define len sizeof (struct student) Struct student * creat (void); Struct student { Char name [11]. Char sno [11]. Int score; Struct student * next; }; Int main (void) { Phead, struct student * * pcur; Pmax_stu struct student * and * pmin_stu; Phead=creat (); Pcur=phead; Pmax_stu=pmin_stu=phead; While (pcur) { If (pcur - & gt; Score & gt; Pmax_stu - & gt; Score) Pmax_stu=pcur; If (pcur - & gt; Score & lt; Pmin_stu - & gt; Score) Pmin_stu=pcur; Pcur=pcur - & gt; Next; } Printf (" % s % s \ n ", pmax_stu - & gt; The name, pmax_stu - & gt; Sno); Printf (" % s % s \ n ", pmin_stu - & gt; The name, pmin_stu - & gt; Sno); # if 0 Struct student * p, * (p1, p2, p3, p4, * p5; Int the Max and min. P=p3 p4==creat (); //it is only a classmate P5=p4; P4=p4 - & gt; Next; /* If (p4 - & gt; Name==NULL) { Printf (" % s % s \ n ", p5 - & gt; The name, p5 - & gt; Sno); Printf (" % s % s \ n ", p5 - & gt; The name, p5 - & gt; Sno); } */ //Max find P1=p; Max=p - & gt; Score; P=p - & gt; Next; Do { If (max<(p - & gt; Score)) { Max=p - & gt; Score; P1=p; } P=p - & gt; Next; } while (p - & gt; next!=NULL); //the minimum for The p2=p3; Min=p3 - & gt; Score; P3=p3 - & gt; Next; Do { If (min> (p3 - & gt; Score)) { Min=p3 - & gt; Score; The p2=p3; } P3=p3 - & gt; Next; } while (p3 - & gt; next!=NULL); Printf (" % s % s \ n ", p1 - & gt; The name, p1 - & gt; Sno); Printf (" % s % s \ n ", p2 - & gt; The name, p2 - & gt; Sno); # endif } Struct student * creat (void) { Int n, I; Struct student * head; P1 struct student * * (p2); The scanf (" % d ", & amp; N); //p2=(struct student *) malloc (len); P1=(struct student *) malloc (len); for(i=0; i The scanf (" % d % s % s ", p1 - & gt; The name, p1 - & gt; Sno, & amp; P1 - & gt; Score); If (I==0) { The head=p1; } The else { The p2 - & gt; Next=p; } P1 p2=; If (I.=n - 1) { P1=(struct student *) malloc (len); } } The p2 - & gt; Next=NULL; Return (the head); } For your reference ~ The building Lord consider more cumbersome, suggested to compare the code to find your own problem CodePudding user response:
nullnull