这段代码哪里错了?
#include <stdio.h>#include <stdlib.h>
#include <malloc.h>
#define LEN sizeof(stu)
typedef struct student
{
char name[10];
char xb[5];
int xh[10];
int yy[5];
int cyy[5];
struct student *next;
}stu;
void input(char arr[])
{
printf("录入系统\n");
FILE *fg;
stu s;
if((fg=fopen(arr,"rb+"))==NULL)
fg=fopen(arr,"w+");
fseek(fg,0L,2);
printf("请输入姓名:");
scanf("%s",s.name);
printf("请输入学号:");
scanf("%d",s.xh);
printf("请输入性别:");
scanf("%s",s.xb);
printf("请输入英语成绩:");
scanf("%s",s.yy);
printf("请输入C成绩:");
scanf("%s",s.cyy);
fwrite(&s,LEN,1,fg);
int shu=1;
printf("退出输入0,否则输入1:");
scanf("%d",&shu);
if(shu==0)s.next=NULL;
while(shu)
{
s=*s.next;
printf("请输入学号:");
scanf("%d",s.xh);
printf("请输入姓名:");
scanf("%s",s.name);
printf("请输入性别:");
scanf("%s",s.xb);
printf("请输入英语成绩:");
scanf("%s",s.yy);
printf("请输入C成绩:");
scanf("%s",s.cyy);
fwrite(&s,LEN,1,fg);
printf("退出输入0,否则输入1:");
scanf("%d",&shu);
if(shu==0)s.next=NULL;
}
fclose(fg);
}
void liulan(char arr[])
{
FILE *fp;
stu a;
if((fp=fopen(arr,"rb+"))==NULL)
printf("不存在文件");
fseek(fp,0L,0);
fread(&a,LEN,1,fp);
while(a.next!=NULL)
{
printf("%s,%s,%d,%d,%d\n",a.name,a.xb,a.xh,a.yy,a.cyy);
a=*a.next;
}
a.next=NULL;
fclose(fp);
}
void main()
{
int flag=1,n;
while(flag)
{
system("cls");
printf("1----------学生录入\n");
printf("2----------学生浏览\n");
printf("3----------学生查询\n");
printf("4----------学生删除\n");
printf("5----------成绩统计\n");
printf("0----------退出系统\n");
printf("请选择(0----5)\n");
scanf("%d",&n);
switch(n)
{
case 0:flag=0;break;
case 1:input("f:\\stu.dat");break;
case 2:liulan("f:\\stu.dat");break;
}
}
}