该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "conio.h"
#include "mem.h"
#include "ctype.h"
#include "alloc.h"
struct score
{
char gukehao[8];
char mingzi[20];
float score[6];
}data,info[1000];
int i,j,k=0;
float n;
char temp[20],ch;
FILE *fp,*fp1;
void luru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i>=0;i++)
{
printf("Please input gukehao:");
gets(data.gukehao);
printf("please input mingzi:");
gets(data.mingzi);
printf("Please input xiaofei:");
gets(temp);data.score[0]=atof(temp);
if(data.score[0]<=5000)
n=1;
else
if(data.score[0]<=10000&&data.score[0]>5000)
n=0.95;
else
n=0.9;
fwrite(&data,sizeof(data),1,fp);
printf("another?(input n to main/anykey to continue)\n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} 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 input shuru xiugai gukehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.gukehao);
if(j==i)
{
printf("gukehao:%s\nmingzi:%s\n",data.gukehao,data.mingzi);
printf("Please input mingzi:");
gets(data.mingzi);
printf("Please input xiaofei:");
gets(temp);data.score[0]=atof(temp);