慕雪6341044
void del()
{
int i, num;
char t = 'y';
FILE *fp, *fp1;
printf("please enter del num:");
scanf("%d", &num);
printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major);
for (n = i; n<m; n++)
{
stu[n] = stu[n + 1];
}
printf("OK");
printf("是否继续删除(y/n)?: ");
scanf("%c", &t);
if (t == 'y' || t == 'Y')
{
i++;
}
fclose(fp);
}
void change()
{
FILE *fp;
int num, i = 0;
char t = 'y';
fp = fopen("inform.txt", "rb+");
while (t == 'y' || t == 'Y')
{
while (1)
{
printf("请输入修改的学号:");
scanf("%d", &num);
if (num > 0)
break;
}
while (!feof(fp))
{
i = 0;
fread(&stu[i], (long)sizeof(struct student), 1, fp);
if (stu[i].num == num&&i == 0)
{
printf("你要修改的学生的信息:\n");
printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major);
i++;
printf("你要修改的学生的信息:\n");
printf("please enter student data:");
scanf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major);
fseek(fp, -(long)sizeof(struct student), 1);
fwrite(&stu[i], (long)sizeof(struct student),