if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL) {
printf("\nopen score.txt was failed!"); getch(); exit(0); }
printf("\nPlease input ID which you want to del:"); scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1) {
j=atoi(data.xuehao); if(j==i) {
printf("Anykey will delet it.\n"); getch(); continue; }
fwrite(&data,sizeof(data),1,fp1); }
fclose(fp); fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n"); printf("Anykey will return to main."); getch(); }
5. 查找模块:
[需求分析]:
该模块的功能是根据输入的学生的姓名查找对应的记录,找到以后,显示相应的学生信息. [流程图]: