错误不会改啊!链表的问题
#include<stdio.h>#include<stdlib.h>
struct student
{
char name[20];
char idnum[8];
char Clanum[4];
float grade[10];
struct student *addr;
};
int main()
{
FILE *inFile;
inFile=fopen("stuImformation.txt","a");
int i;
char ch;
struct student *t1, *t2, *head;
head = NULL;
do
{
t2 = (struct student *)malloc(sizeof(struct student));
printf("请输入学生的姓名:");
scanf("%s", t2->name);
printf("\n请输入学生的学号:");
scanf("%s", t2->idnum);
printf("\n请输入学生的班级:");
scanf("%s", t2->Clanum);
printf("\n请输入学生各科的成绩");
for(i=1;i<11;i++)
{
scanf("%f",t2->grade[i]);
}
if(head == NULL)
{
head = t2;
t1 = head;
}
else
{
t1->addr = t2;
t1 = t1->addr;
}
getchar();
printf("是否继续录入?(y or n)");
ch = getchar();
}while(ch!='y');
fclose(inFile);
return 0;
}