exit(0); }
for(i=0;i<=1000;i++) {
if((fread(&info[i],sizeof(info[i]),1,fp))!=1) /*检查是否出错*/
break; /*指针 要读写字节数 要读写size字节的数据项 文件型指针*/ }
printf("\nxuehao mingzi nianling shuxue yingyu wuli zongfen\n"); for(j=0,k=1;j<i;j++,k++) {
info[j].mingci=k; printf("%6s %8s %3s %3.1f %3.1f %3.1f %3.1f \n",info[j].xuehao,info[j].mingzi,info[j].nianling,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3]); }
getch(); fclose(fp); }
void xiugai() {
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL) /*检查是否出错*/ {
printf("Cannot open this file.\n"); exit(0); }
printf("\nPLease shuru xiugai xuehao:"); scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1) {
j=atoi(data.xuehao); if(j==i) {
printf("xuehao:%s\nmingzi:%s\nnianling:%s\n",data.xuehao,data.mingzi,data.nianling);
printf("Please shuru mingzi:"); gets(data.mingzi);
printf("Please shuru shuxue score:"); gets(temp);data.score[0]=atof(temp); printf("Please input yingyu score:"); gets(temp);data.score[1]=atof(temp); printf("Please input wuli score:");