You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
580 B
36 lines
580 B
#include"显示.c"
|
|
void dele() /* 删除信息 */
|
|
{
|
|
int i,j,flag=0;
|
|
char s1[LEN+1];
|
|
printf("请输入要删除学生的学号:\n");
|
|
scanf("%s",s1);
|
|
for(i=0;i<n;i++)
|
|
if(strcmp(stu[i].id,s1)==0)
|
|
{
|
|
flag=1;
|
|
for(j=i;j<n-1;j++)
|
|
stu[j]=stu[j+1];
|
|
}
|
|
if(flag==0)
|
|
printf("该学号不存在!\n");
|
|
if(flag==1)
|
|
{
|
|
printf("删除成功,显示结果请选择菜单6\n");
|
|
n--;
|
|
}
|
|
}
|
|
void save() /* 保存 */
|
|
{
|
|
int i;
|
|
FILE *fp;
|
|
fp=fopen("student.txt","w"); /*写入*/
|
|
for(i=0;i<n;i++)
|
|
{
|
|
fprintf(fp,"%s %s %d %s %s %s %s %s\n",stu[i].id,stu[i].name,stu[i].age,
|
|
stu[i].sex,stu[i].birth,stu[i].add,stu[i].tel,stu[i].email);
|
|
}
|
|
fclose(fp);
|
|
}
|
|
|