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.
lzlzlz/删除函数和保存函数.c

36 lines
582 B

#include"<22><>ʾ.cpp"
void dele() /* ɾ<><C9BE><EFBFBD><EFBFBD>Ϣ */
{
int i,j,flag=0;
char s1[LEN+1];
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\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("<EFBFBD><EFBFBD>ѧ<EFBFBD>Ų<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
if(flag==1)
{
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>,<2C><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>˵<EFBFBD>6\n");
n--;
}
}
void save() /* <20><><EFBFBD><EFBFBD> */
{
int i;
FILE *fp;
fp=fopen("student.txt","w"); /*д<><D0B4>*/
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);
}