#include <stdio.h> #include <stdlib.h> typedef struct student { int ID; char name[20]; float score; struct student *next; }Stu; Stu *jianli() { Stu *p1,*p2,*head=NULL; do { p1=(Stu *)malloc(sizeof(Stu)); if(head==NULL) head=p1; else p2->next=p1; p2=p1; p2->next=NULL; scanf("%d,%s,%f",&p2->ID,p2->name,&p2->score); }while(p2->ID!=0); return head; } void show(Stu *head) { Stu *p=head; while(p->next!=NULL) { printf("%d,%s,%f\n",p->ID,p->name,p->score); p=p->next; } } int main() { Stu *s; s=jianli(); show(s); return 0; }
慕粉13202587281
快乐的时光
相关分类