user-0 提问: 编写成绩管理系统遇到的一些问题请教。

回复:
user: user-1
content: 参考一下——http://blog.csdn.net/u012421456/article/details/40015333

user: user-1
content: 引用 3 楼 axiqia 的回复:问题1： struct student *searchbyname(struct student *head) {     char c;     struct student *stu2;     stu2=(struct student *)malloc(LEN);       printf("Please enter the name :");     scanf("%s",stu2->name);       struct student *p1,*p0;       p1=head;     p0=stu2;       while((p0->name!=p1->name)&&(p1->next!=NULL))     {          p1=p1->next;     }     if(p0->name!=p1->name)         printf("%d %s %lf",p1->no,p1->name,p1->score);     else {         printf("Please cheak your name !");         searchbyname(head);     }     while(1)     {         printf("\n是否继续搜索成员？输入 Y 继续，输入 N 返回:\n");         scanf("%c",&c);                                      //   没有执行？debug时直接就调过了         if(c=='n'||c=='N')             break;         else if (c=='Y'||c=='y');             searchbyname(head);     }     system("pause");     return head; }; 这个可能是因为前面的输入导致缓冲区有回车\n存在，加个getchar()试试，

user: user-0
content: 问题三： void read(struct student *head ) {     FILE *fp;     struct student*p;     p=head;     fp=fopen("student.txt","r");     if(fp==NULL)     {         printf("打开文件出错\n");         exit(1);     }     while(p->next!=NULL)     {         fread(p,sizeof(LEN),1,fp);         p=p->next;     }     fclose(fp); } 如果把数据写入链表中呢？

user: user-0
content: 问题2： void save(struct student *head ) {     FILE *fp;     struct student*p;     p=head;     fp=fopen("student.txt","w");       if(fp==NULL)     {         printf("打开文件出错\n");         exit(1);     }     while(p->next!=NULL)     {         fwrite(p,LEN,1,fp);         p=p->next;     }     fclose(fp); } 由于没有老师没有讲关于文件的部分，所以对文件操作还是有很大问题。该怎么把创建好的链表写入文件中？

user: user-0
content: 问题1： struct student *searchbyname(struct student *head) {     char c;     struct student *stu2;     stu2=(struct student *)malloc(LEN);       printf("Please enter the name :");     scanf("%s",stu2->name);       struct student *p1,*p0;       p1=head;     p0=stu2;       while((p0->name!=p1->name)&&(p1->next!=NULL))     {          p1=p1->next;     }     if(p0->name!=p1->name)         printf("%d %s %lf",p1->no,p1->name,p1->score);     else {         printf("Please cheak your name !");         searchbyname(head);     }     while(1)     {         printf("\n是否继续搜索成员？输入 Y 继续，输入 N 返回:\n");         scanf("%c",&c);                                      //   没有执行？debug时直接就调过了         if(c=='n'||c=='N')             break;         else if (c=='Y'||c=='y');             searchbyname(head);     }     system("pause");     return head; };

user: user-2
content: 代码有什么问题？

user: user-0
content: struct student *change(struct student *head) {     int num;     struct student *stu;     stu=head;     while(1)     {         printf("请输入查找方式：\n");         printf("学号修改，请输入1\n");         printf("姓名修改，请输入2\n");         printf("返回主菜单，请输入3\n");          scanf("%d",&num);         switch(num)         {             case 1:changebynum(stu);             case 2:changebyname(stu);             case 3:goto END; break;             default :printf("暂不支持，请重新输入\n");break;         }     } END :     system("pause");     return head; }  struct student *changebynum(struct student *head) {     char c;     struct student *stu2;     stu2=(struct student *)malloc(LEN);      struct student *p1,*p0;      p1=head;     p0=stu2;      printf("Please enter the no :");     scanf("%d",&p0->no);     while((p0->name!=p1->name)&&(p1->next!=NULL))     {          p1=p1->next;     }     if(p1->next==NULL)         changebynum(head);       printf("输入要修改成员的资料");     printf("Please enter the name:");     scanf("%s",stu2->name);     strcpy(p1->name,p0->name);     printf("Please enter the score:");     scanf("%lf",&stu2->score);     p1->score=p0->score;      while(1)     {         printf("\n是否继续修改成员？输入 Y 继续，输入 N 返回:\n");         scanf("%c",&c);                                                                                      //   没有执行？         if(c=='n'||c=='N')             break;         else if (c=='Y'||c=='y');             changebynum(head);     }     system("pause");     return head; };  struct student *changebyname(struct student *head) {     char c;     struct student *stu2;     stu2=(struct student *)malloc(LEN);      struct student *p1,*p0;      p1=head;     p0=stu2;      printf("Please enter the name :");     scanf("%s",p0->name);     while((p0->name!=p1->name)&&(p1->next!=NULL))     {          p1=p1->next;     }     if(p1->next==NULL)         changebyname(head);       printf("输入要修改成员的资料");     printf("Please enter the num:");     scanf("%d",&stu2->no);     p1->no=p0->no;     printf("Please enter the score:");     scanf("%lf",&stu2->score);     p1->score=p0->score;      while(1)     {         printf("\n是否继续修改成员？输入 Y 继续，输入 N 返回:\n");         scanf("%c",&c);                                                                                      //   没有执行？         if(c=='n'||c=='N')             break;         else if (c=='Y'||c=='y');             changebyname(head);     }     system("pause");     return head; };  void save(struct student *head ) {     FILE *fp;     struct student*p;     p=head;     fp=fopen("student.txt","w");  	if(fp==NULL) 	{ 		printf("打开文件出错\n"); 		exit(1); 	} 	while(p->next!=NULL)     {         fwrite(p,LEN,1,fp);         p=p->next;     }     fclose(fp); }  void read(struct student *head ) {     FILE *fp;     struct student*p;     p=head;     fp=fopen("student.txt","r");     if(fp==NULL)     {         printf("打开文件出错\n");         exit(1);     }     while(p->next!=NULL)     {         fread(p,sizeof(LEN),1,fp);         p=p->next;     }     fclose(fp); }  以上是代码的全部。 小白一个，学了C一学期，学艺不精，第一次独立写500行以上的程序，只能写到这个地步了。还是有点自知之明，知道写的不怎么样，所以大家有什么要批评的，我都会虚心接受。如果大家能给予帮助，不胜感激，恳请广大坛友指教。