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.

63 lines
1.2 KiB

6 years ago
#include"c3.cpp"
void modify() //<2F>ɼ<EFBFBD><C9BC>޸<EFBFBD>
{
char st[30];
double x,num;
float nu;
int k=0;
system("cls");
if((fp=fopen("a.txt","r"))==NULL)
{
printf("Cannot open the file!\n");
return;
}
while(fscanf(fp,"%lf%s%f",&s[k].no,s[k].name,&s[k].cscore)!=EOF)
{
k++;
}
fclose(fp);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>޸ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%lf",&x);
if(x==1)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ijɼ<EFBFBD><EFBFBD>˵<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
scanf("%lf",&num);
for(int i=0;i<k;i++)
if(num==s[i].no)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵijɼ<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%f",&nu);
s[i].cscore=nu;
fp=fopen("a.txt","w");
for(i=0;i<k;i++)
fprintf(fp,"%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
fclose(fp);
printf("<EFBFBD>޸ijɹ<EFBFBD>\n");
return;
}
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
return;
}
if(x==2)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ijɼ<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",st);
for(int i=0;i<k;i++)
if(strcmp(s[i].name,st)==0)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵijɼ<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%f",&nu);
s[i].cscore=nu;
fp=fopen("a.txt","w");
for(i=0;i<k;i++)
fprintf(fp,"%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
fclose(fp);
printf("<EFBFBD>޸ijɹ<EFBFBD>\n");
return;
}
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
return;
}
}